Bug #60160 [Com]: imagefill() doesn't work correctly for small images
| From: | kieran at menor dot dk | Date: | Fri, 28 Oct 2011 17:39:06 +0000 |
| Subject: | Bug #60160 [Com]: imagefill() doesn't work correctly for small images | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164647@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
Comment by: kieran at menor dot dk
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:
Workaround:
------------
Use imagefilledrectangle() instead, alike so:
function imagefillfix($image, $x, $y, $color)
{
return imagefilledrectangle($image, $x, $y, imagesx($image) - 1, imagesy($image) - 1, $color);
}
Previous Comments:
------------------------------------------------------------------------
[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