I am working on a project with GD and I need to fill and an image with a color. Sounds easy, but the imagefill doesn't seem to be working. I will create an image, and allocate the color and then I will use imagefill, which returns true, but doesn't actually fill anything with color. Here's the weird part: It will work if the image is smaller than what I want. If I replace the variables that state the size of the image I create with smaller numbers, then the image fills with color fine, any bigger and it stays black. It gets weirder that the "breaking point" where the color fills and when it doesn't seems to change everyonce in a while too without any change to the code.
Any suggestions to what the problem could possibly be?
Here is some sample code I ripped out of my script that behaves the same way:
<?php
$print = imagecreatetruecolor(100, 100);
$image = imagecreatetruecolor(249, 249); #<-- Normally variables in place of the 249's
$mat1 = imagecolorallocate($image, 255, 255, 0);
if(!imagefill($image, 0, 0, $mat1)){
print("Image not filling!"); exit;
}
imagecopy($image,$print,50,50,0,0,100,100);
header("Content-type: image/jpg");
imagejpeg($image);
imagedestroy($image); // Free memory
?>