Resize - max only

See all posts See thread Reply

Re: Resize - max only new!
by seanie, 17 years, 7 months ago
This bit resizes if its x is over 600
Check out php.net for more info on getimagesize()
$info = getimagesize($handle->file_src_pathname);
if ($info[0]>600) {
    // resize
} else {
    // dont resize
}
Reply
Re: Resize - max only new!
by colin, 17 years, 7 months ago
Thanks Seanie, your code is correct, however there is a better way to do it: the class provides a parameter called image_ratio_no_zoom_in

From the doc:
image_ratio_no_zoom_in same as image_ratio, but won't resize if the source image is smaller than image_x x image_y (default: false)

So Tim, if you want to resize images that are bigger than 500px, but keep it as is if it is smaller, use the following code:
$handle->image_resize = true;
$handle->image_ratio_no_zoom_in	= true;
$handle->image_x = 500;
$handle->image_y = 500;
Reply