i was wondering, if it would be possible to embed images into a kirbytext, but generate thumbnails when showing them. Would this be possible with a custom kirbytag?
If yes, how?
My guess is, something along the lines of:
$image = $tag->page()->url().'/'.$tag->attr('fancyimage');
return thumb($image(), array('width' => 300));
but this doesn’t work, of course…
That works like a charm. Thanks a lot!
I just tried implementing this, and for some reason it always sets the height of the thumbnail as the actual height of the image. I can change the width, but I can’t change the height. Any ideas?
You mean the value the
$thumb object returns when calling
$thumb->height()? The reason for this is that the width and height scaling is done right before generating the thumb by the thumb driver function currently and not as soon as creating the object.
I have opened an issue on GitHub about this.