|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-10-28 17:30 UTC] 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
Patchesbug60160.phpt (last revision 2011-10-31 15:26 UTC by fa@php.net)fix-imagefill-for-images-smaller-than-4px-width (last revision 2011-10-31 14:51 UTC by fa@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
Workaround: ------------ Use imagefilledrectangle() instead, alike so: function imagefillfix($image, $x, $y, $color) { return imagefilledrectangle($image, $x, $y, imagesx($image) - 1, imagesy($image) - 1, $color); }