Bug #60160 [PATCH]: imagefill() doesn't work correctly for small images
| From: | fa@php.net | Date: | Mon, 31 Oct 2011 14:51:05 +0000 |
| Subject: | Bug #60160 [PATCH]: imagefill() doesn't work correctly for small images | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164725@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60160&edit=1
ID: 60160
Patch added by: fa@php.net
Reported by: kieran at menor dot dk
Summary: imagefill() doesn't work correctly for small images
Status: Open
Type: Bug
Package: GD related
Operating System: Windows 7 x64, Debian 6 x64
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: fix-imagefill-for-images-smaller-than-4px-width
Revision: 1320072664
URL: https://bugs.php.net/patch-display.php?bug=60160&patch=fix-imagefill-for-images-smaller-than-4px-width&revision=1320072664
Previous Comments:
------------------------------------------------------------------------
[2011-10-28 17:39:06] kieran at menor dot dk
Workaround:
------------
Use imagefilledrectangle() instead, alike so:
function imagefillfix($image, $x, $y, $color)
{
return imagefilledrectangle($image, $x, $y, imagesx($image) - 1, imagesy($image) - 1, $color);
}
------------------------------------------------------------------------
[2011-10-28 17:30:08] kieran at menor dot dk
Description:
------------
imagefill() doesn't work correctly for images with a width lower than 4 pixels. Image height
makes no difference.
Test script:
---------------
<?php
header('Content-Type: image/png');
$im = imagecreatetruecolor(3, 3);
imagefill($im, 0, 0, imagecolorallocate($im, 255, 255, 255));
imagepng($im);
imagedestroy($im);
Expected result:
----------------
Completely white 3x3 pixels image expected.
Actual result:
--------------
Upper and left edge white, 2x2 black square in lower right corner.
http://caffie.net/broken.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60160&edit=1