Resize by x OR y

See all posts Reply

Resize by x OR y new!
by Simon H, 17 years, 7 months ago
I want to resize an image, lets say to fit within a 200x200 box.

The image could be landscape or portrait and I want the resize to keep image proportions.

How do I resize X OR resize Y to 200 with the other axis set as ratio dependant on which axis is longest in the origional image.

I hope that makes sence.Reply
Re: Resize by x OR y new!
by colin, 17 years, 7 months ago
It makes sense ;)

Use
$foo->image_ratio = true;
$foo->image_x = 200;
$foo->image_y = 200;

So the image will fit within 200x200, and the ratio will be maintained.

This is in the doc by the way:
image_ratio if true, resize image conserving the original sizes ratio, using image_x AND image_y as max sizes if true (default: false)Reply
Re: Resize by x OR y new!
by Simon, 17 years, 7 months ago
Cheers Colin, perfect :)

Some how I missed the image_ratio option and was trying to make it work using image_ratio_x and image_ratio_y instead :SReply