the docs suggest the following snippet for creating thumbnails of images outside of the content folder:
$myimage = new Media(
// the absolute path for the file
'/var/www/myimages/image.jpg',
// the absolute url
'http://mydomain.com/images/image.jpg'
);
echo thumb($myimage, array('width' => 300));
However this is misleading as it doesn’t work as expected.
It seems like using the “thumb()” function like this makes it ignore any configuration you have in your config.php file (like the driver to use…). And for some reason it defaults to the “im” driver (so on systems without imagemagick you get a “sh: 1: convert: not found” error).
Since Kirby 2.3 this is intended behavior for the Media class (it is part of the Toolkit and we made the thumb generation independent from the Kirby CMS so that it can be used in other projects).
What you are looking for is the new Asset class:
$myimage = new Asset($filepath);
echo thumb($myimage, array('width' => 300));
$filepath should be a relative path like assets/images/myimage.jpg.
It looks like we forgot to update the docs, I will do so now. Thanks for letting us know.
The url is messed up as it contains both the url and the path on the same row. The dimensions are set to 0 so I guess it does not read the image file correctly.