Reply to Re: Crop without resize

Re: Crop without resize new!
by colin, 14 years, 1 month ago
You can do this indirectly: you can read image_src_x and image_src_y before calling process(), and act accordingly. For instance (not tested):
// the size you want
$my_x = 100;
$my_y = 100;
// the margins you will have to crop
$crop_x = (int) (($handle->image_src_x - $my_x) / 2);
$crop_y = (int) (($handle->image_src_y - $my_y) / 2);
// we set the cropping values
$handle->image_crop = array($crop_y, $crop_x, $crop_y, $crop_x);
// and call process()
$handle->process(...);
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important