Hi.
I'm trying to generate thumbnails based on image orientation. I would like to resize the image keeping its ratio by its smaller dimension, and then crop the rest so it fits the given area.
For example:
source: 200x150px
target: 100x100px
Image orientation is landscape, so I take the smaller dimension (height: 150px).
I resize it using SetHeight(100) to 133x100px and then use CroppedImage(100,100) to crop the center part of the processed image.
However, first usage of getFormattedImage() returns Image_Cached object and for some reason I cannot use the function again on this object, because it returns null.
How do I make the following code to work?
function getThumbLandscape() {
$img = $this->Image();
print_r($img); // this prints out Image object
$img = $img->getFormattedImage('SetHeight',100);
print_r($img); // this prints out Image_Cached object
$img = $img->getFormattedImage('CroppedImage',100,100);
print_r($img); // this prints out null ???!!?
return $img;
}
Please help!