User tests: Successful: Unsuccessful:
When calling JImage::crop() without passing in a value for $top, this offset is automatically calculated (same for $left - the left offset). I found the calculated top offset to be -1 in some cases - especially when JImage::resize() was applied first. I discovered that the calculation of the width and height values in JImage::prepareDimensions() is the reason. In my case i upload a file which is first resized and then cropped. Both methods receive the same height value (152px), because the input file is a portrait and i require a height of 152px. But the height value changes to 151px while the file passes JImage::resize(). I debugged the input- and output values just to find the place where the height is altered and found JImage::prepareDimension() to be the place - case SCALE_INSIDE. I could not yet figure out if its the rounding that works inaccurately.
As a consequence the created image always shows a 1px thick black line on its top border (due to the black imagefill color) indicating that imagecopy() starts pasting the pixels copied from the source image at the second row of the target image.
The suggested fix checks whether the calculated height offset value is
Status | New | ⇒ | Pending |
Labels |
Removed:
?
|
Status | Pending | ⇒ | Information Required |
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-11-03 17:21:28 |
Closed_By | ⇒ | roland-d |
Hello @itbra
Thank you for your contribution.
As there has been no comments on this, is this issue/pull request still valid? Perhaps start the discussion on the Joomla Google group. You are more likely to get a response there.
If no reply is received within 4 weeks we will close this issue.
Thanks for understanding!
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/3587.