problem with cropping

See all posts Reply

problem with cropping new!
by Premberg, 14 years, 3 months ago
Hi!
I want to get an image 424*204 ... I´ve uploaded a picture with dimensions 600*400. I want the script to cropped it so the the new picture is 424*204 (Center-cropped) I dont understand what the different values in the array ( $handle->image_crop = array(200,200,200,200);) work... ?

How should you write the crop-array to get the new dimensions ?
Please help!

Best regards
PrembergReply
Re: problem with cropping new!
by colin, 14 years, 3 months ago
As per the docs:
image_crop crops image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)

So the array reads:
$handle->image_crop = array(top, right, bottom, left);
Or, as a string:
$handle->image_crop = 'top, right, bottom, left';
Reply
Re: problem with cropping new!
by Premberg, 14 years, 3 months ago
And how would you write it if you wanted to get the picture 424*204 ?

Thank you for all the help!

/PReply
Re: problem with cropping new!
by colin, 14 years, 3 months ago
Erm... (600-424)/2 = 88 and (400-204)/2=98. So:

$handle->image_crop = array(98, 88, 98, 88);
Reply