How to crop automatically keeping ration and fit in specific x and y

See all posts Reply

How to crop automatically keeping ration and fit in specific x and y new!
by Paris Paraskevas, 17 years, 6 months ago
I want all my images to have the same size, width and height. so when i upload an image that will be resized to 100x100 pixels for example and keep the ratio by cropping the bits that are left over at either the height or width of the image.

i there a way to do this with your upload class?

many thanks for the wonderfull work.Reply
Re: How to crop automatically keeping ration and fit in specific x and y new!
by Paris Paraskevas, 17 years, 6 months ago
:) just seen that this is a new feature in 0.21 :)

superb :)

just tested it and it works :)

very well doneReply
Re: How to crop automatically keeping ration and fit in specific x and y new!
by colin, 17 years, 6 months ago
You're fast, I was actually about to answer you when I saw your own reply...

I will release v0.21 soon, it seems like the RC is fine.Reply
Re: How to crop automatically keeping ration and fit in specific x and y new!
by seanie, 17 years, 6 months ago
can you give some example code please.
ThanksReply
Re: How to crop automatically keeping ration and fit in specific x and y new!
by colin, 17 years, 6 months ago
Yes, sure.

$foo->image_x = 100;
$foo->image_y = 150;
$foo->image_ratio_crop = true;
$foo->image_convert = 'jpg';
$foo->resize = true;

The image will be resized so that it fills 100x150, and the excedent will be cropped. So all your thumbnails have the same dimensions, even if the full size images have different ratios.Reply