php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44847 Imagefill(), x and y do not work
Submitted: 2008-04-27 16:55 UTC Modified: 2008-04-27 17:08 UTC
From: simslim at gmail dot com Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 5.2.5 OS: Win XP
Private report: No CVE-ID: None
 [2008-04-27 16:55 UTC] simslim at gmail dot com
Description:
------------
I use imagefill to fill a picture, but no matter what I enter as start x and y, it always fills the whole image (with x and y higher then 0 and not higher then image sizes)

Reproduce code:
---------------
header("Content-Type: image/png");
$img	= imagecreatetruecolor(100,100);
$red	= imagecolorallocate($img,255,0,0);
$green	= imagecolorallocate($img,0,255,0);
imagefill($img,0,0,$red);
imagefill($img,50,0,$green);
imagepng($img);

Expected result:
----------------
A picture, 100 x 100, with the left half red and the right half green

Actual result:
--------------
A picture, 100 x 100, completely green

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-27 17:02 UTC] pajoye@php.net
imagefill _fills_ the image until an edge has been met, what you are trying to do should be done using imagefilledrectangle.
 [2008-04-27 17:08 UTC] simslim at gmail dot com
I'm sorry, I didn't understand that the filling goes too all directions untill it hits a border.
I hope the manual page about this function can be changed because I think it's unclear for other people too.
Thanks for the quick reply!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 21:00:03 2025 UTC