In the function "image_gd_crop" in "image.inc" the first two parameters are in the wrong order resulting in a black image.
From the documentation of "imageCopy" (http://php.belnet.be/manual/nl/function.imagecopy.php):
int imagecopy ( resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)
Copy a part of src_im onto dst_im starting at the x,y coordinates src_x, src_y with a width of src_w and a height of src_h. The portion defined will be copied onto the x,y coordinates, dst_x and dst_y.
So by doing:
$im = image_gd_open($source, $info['extension']);
$res = imageCreateTrueColor($width, $height);
imageCopy($im, $res, 0, 0, $x, $y, $width, $height);
$result = image_gd_close($res, $destination, $info['extension']);
you actually copy a part of the new black image ($res) into the original image ($im) instead of the other way around. The end result is that $res stays a black image. The fact that the original image ($im) now has a black part in it was of no importance as $im is discarted afterwards without saving it back to $source.
The same error is present in CVS-HEAD.
Patch attached (for 4-6).
Comment | File | Size | Author |
---|---|---|---|
image.inc_0.patch | 638 bytes | Robrecht Jacques | |
Comments
Comment #1
Dries CreditAttribution: Dries commentedCommitted to HEAD and DRUPAL-4-6. Thanks.
Comment #2
(not verified) CreditAttribution: commentedComment #3
ken123 CreditAttribution: ken123 commentedComment #4
(not verified) CreditAttribution: commentedComment #5
(not verified) CreditAttribution: commentedComment #6
(not verified) CreditAttribution: commented