php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30580 GD imagecolorallocate does not work after many allocations
Submitted: 2004-10-27 13:59 UTC Modified: 2004-11-08 12:26 UTC
From: jay at kuantic dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.0.2 OS: Linux fedora core 1
Private report: No CVE-ID: None
 [2004-10-27 13:59 UTC] jay at kuantic dot com
Description:
------------
After several color allocations, imagecolorallocate seems to no work anymore. See code sample (illogical but point at the problem).

Reproduce code:
---------------
function letter($l, $x, $y, $img)	{
	$color1 = imagecolorallocate($img, 190, 190, 190);
	imagestring ($img, 1, $x+1, $y+1, $l, $color1);
	
	$color2 = imagecolorallocate($img, 190, 190, 190);
	imagestring ($img, 1, $x-1, $y-1, $l, $color2);
	
	$color3 =  in a picture.($img, 255, 0, 0);
	imagestring ($img, 1, $x, $y, $l, $color3);
}
$image = @imagecreate (1200, 500);
$background_color = imagecolorallocate ($image, 255, 255, 255);
for ($i = 0; $i < 100; $i++)	{
	letter($i, $i*12, 50, $image);
} 
header ("Content-type: image/png");	
imagepng ($image);
imagedestroy($image);

Expected result:
----------------
expected : display 1 to 100 red digits with gray shadow in a picture.

Actual result:
--------------
result : displays 1 to 84 red digits with gray shadow in a picture. After 84, digits and shadows are all red. imagecolorallocate seems to not work anymore.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-08 12:26 UTC] john@php.net
You're reaching the palette limit. Create the image using imagecreatetruecolor()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 09:01:27 2024 UTC