Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.5

Bug #6000 crop() for Imgick1&2 don't work correctly!
Submitted: 2005-11-17 16:48 UTC
From: chri1709 Assigned: pajoye
Status: Closed Package: Image_Transform
PHP Version: 4.3.10 OS: Debian Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-17 16:48 UTC] chri1709
Description: ------------ crop() for Imgick1&2 don't work correctly! There's a test script detailing the bug. Test script: --------------- $im = Image_Transform::factory(''); $im->load('test.jpg'); $width = $im->getImageWidth(); // example: 200 $height = $im->getImageHeight(); // example: 2000 $aspect = $width / $height; // 200/2000 = 0.1 $im->scaleByX(120); \\ width = 120, height = 120/aspect = 1200 $im->crop(120,80,0,(120/$aspect-80)/2); \\ (120/$aspect-80)/2 = (1200-80)/2 = 1120/2 = 560 \\ Image size should be now 120x80! The real Image size is 120x640! Expected result: ---------------- Wrong Image size! The getImageHeight() and getImageWidth() methods return the correct size but after calling the save() method you will see that Image size is not correct!

Comments

 [2005-11-17 20:01 UTC] chri1709
I fixed the bug myself. Replace... if (!imagick_crop($this->imageHandle, $x, $y, $x + $width, $y + $height)) { return $this->raiseError('Couldn\'t crop image.', IMAGE_TRANSFORM_ERROR_FAILED); } ...with... if (!imagick_crop($this->imageHandle, $x, $y, $width, $height)) { return $this->raiseError('Couldn\'t crop image.', IMAGE_TRANSFORM_ERROR_FAILED); } Now it should work properly.
 [2005-11-19 03:29 UTC] gauthierm
http://pear.php.net/bugs/6011 is a dupe of this bug. #6011 contains a patch to CVS.
 [2006-03-07 21:37 UTC] jausions
 [2006-04-29 13:28 UTC] pajoye (Pierre-Alain Joye)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.