Bug #77200 [Asn->Csd]: imagecropauto(â¦, GD_CROP_SIDES) crops left but not right
| From: | cmb@php.net | Date: | Sun, 25 Nov 2018 18:05:18 +0000 |
| Subject: | Bug #77200 [Asn->Csd]: imagecropauto(â¦, GD_CROP_SIDES) crops left but not right | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218130@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77200&edit=1
ID: 77200
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: imagecropauto(â¦, GD_CROP_SIDES) crops left but not
right
-Status: Assigned
+Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 7.2Git-2018-11-25 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a1aaec08b5a3fc0f36cf91f034b4232285c6e793
Log: Fix #77200: imagecropauto(â¦, GD_CROP_SIDES) crops left but not right
Previous Comments:
------------------------------------------------------------------------
[2018-11-25 17:02:56] cmb@php.net
Description:
------------
Forwarding from upstream[1], since our bundled libgd is affected
as well.
The test script creates an image with four unicolored quadrants.
If the same color is used for the top left and bottom left
quadrants, imagecropauto(â¦, GD_CROP_SIDES) works as expected. If
the same color is used for the top right and bottom right
quadrants, imagecropauto(â¦, GD_CROP_SIDES) fails to crop, though.
[1] <https://github.com/libgd/libgd/issues/486>
Test script:
---------------
<?php
$orig = imagecreatetruecolor(8, 8);
$red = imagecolorallocate($orig, 255, 0, 0);
$green = imagecolorallocate($orig, 0, 255, 0);
$blue = imagecolorallocate($orig, 0, 0, 255);
imagefilledrectangle($orig, 0, 0, 3, 3, $green); // tl
imagefilledrectangle($orig, 4, 0, 7, 3, $red); // tr
imagefilledrectangle($orig, 0, 4, 3, 7, $green); // bl
imagefilledrectangle($orig, 4, 4, 7, 7, $blue); // br
$cropped = imagecropauto($orig, IMG_CROP_SIDES);
var_dump(imagesx($cropped));
imagefilledrectangle($orig, 0, 0, 3, 3, $red); // tl
imagefilledrectangle($orig, 4, 0, 7, 3, $green); // tr
imagefilledrectangle($orig, 0, 4, 3, 7, $blue); // bl
imagefilledrectangle($orig, 4, 4, 7, 7, $green); // br
$cropped = imagecropauto($orig, IMG_CROP_SIDES);
var_dump(imagesx($cropped));
Expected result:
----------------
int(4)
int(4)
Actual result:
--------------
int(4)
int(8)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77200&edit=1