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

Bug #13697 Image Thumbnail ignoring alignment
Submitted: 2008-04-16 17:39 UTC
From: nak5ive Assigned: firman
Status: Closed Package: Image_Tools (version 0.4.2)
PHP Version: Irrelevant OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2008-04-16 17:39 UTC] nak5ive (Al Kent)
Description: ------------ When using the method option of SCALE_MIN for the thumbnail generation, an assignment of horizontal or vertical alignment is ignored. the value is set within the thumbnail object, but in calculation it is overwritten. i have attached a copy of the Thumbnail.php file with the marked correction within the render() function. Test script: --------------- $img =& Image_Tools::factory('thumbnail', array('image' => 'somelargeimage.jpg', 'width' => 60, 'height' => 60, 'method' => IMAGE_TOOLS_THUMBNAIL_METHOD_SCALE_MIN, 'halign' => IMAGE_TOOLS_THUMBNAIL_ALIGN_CENTER)); $img->save('sometinyimage.jpg', IMAGETYPE_JPEG); Expected result: ---------------- expected to see the image resized to be circumscribed around the alloted space of 60 x 60, centered on that space, and cropped. Actual result: -------------- the image was not center, but left aligned everytime, despite the alignment option used in the factory method.

Comments

 [2008-04-17 16:44 UTC] neufeind (Stefan Neufeind)
Added a diff of your file against cvs-head (not yet reviewed, tried or anything!). So basically you moved an initialisation-part?
 [2008-04-17 16:53 UTC] nak5ive (Al Kent)
moving the instantiation of x=0 and y=0 is all that was required to fix the problem. previously, the assignment of zero to these two values was after the calculation, overwriting the previous setting.
 [2008-05-21 02:14 UTC] firman (Firman Wandayandi)
Seems you right, the $X and $Y have overwritten by the zero when its already calculated. Your patch committed on CVS, thanks.