Cropping images with getThumbnail

Permalink
I need to crop a perfect square image (300x300) from images that have different aspect ratios. Some of these images may not even be 300px wide, but I need to output them as 300x300 no matter what. Even if that means expanding either height or width to 300px then cropping the other side at 300.

Using getThumbnail, it won't up the size of an image to crop it, it can't make the thumbnail bigger than the image.

I've even tried running the getThumbnail on itself, to crop the image at 9999,300 then 300,300, but I get an unknown error:
filemtime(): stat failed for /application/files/cache/11a3e1394a4cd1c3b8385f512dee4026.jpg

So how should this be done? Do I need an external library to make this happen?

ob7dev
 
ob7dev replied on at Permalink Reply
ob7dev
I see in the BasicThumbnailer.php that the width and height given are named maxHeight, and maxWidth. Do we need to extend this class somehow to allow resizing to fill the area exactly?
Gondwana replied on at Permalink Best Answer Reply
Gondwana
Thumbnails may be a bit inflexible. Maybe look at this:http://documentation.concrete5.org/developers/working-with-files-an...