ID: 46466
User updated by: laszlo dot janszky at gmail dot com
Reported By: laszlo dot janszky at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: GD related
Operating System: windows xp
PHP Version: 5.2.6
Assigned To: pajoye
New Comment:
OK! It looks like that I exceeded the 256 colors limit. Thanks to
everbody.
Previous Comments:
------------------------------------------------------------------------
[2008-11-03 08:43:10] [EMAIL PROTECTED]
Please provide a small script to reproduce it. Do not use anything but
the image function and the PHP core functions (no rand, db, input data,
etc.).
And keep in mind that palette images can have maximum 256 colors (255 +
bgd).
------------------------------------------------------------------------
[2008-11-03 08:34:32] laszlo dot janszky at gmail dot com
Now I checked it manually, i saved all the settings in a table, and
loaded it. It's generating the bug without rand() too.
Here is the table:
$c $char $r $b $g $a $s $l $t
1; 0; 0; 237; 150; 6; 20; 15; 31
9; 1; 5; 250; 142; 3; 20; 30; 33
17; 2; 23; 237; 130; 9; 19; 45; 33
25; 3; 21; 255; 147; 10; 18; 60; 37
33; 4; 28; 240; 150; 8; 19; 75; 30
41; 5; 10; 243; 124; 5; 21; 90; 36
49; 6; 8; 240; 149; 7; 18; 105; 35
57; 7; 18; 247; 128; 1; 21; 120; 30
65; 8; 2; 249; 142; 5; 22; 135; 36
72; 9; 17; 225; 138; 3; 22; 150; 34
80; a; 5; 230; 131; 6; 19; 165; 35
88; b; 22; 240; 145; 4; 18; 180; 39
96; c; 24; 226; 132; 9; 20; 195; 30
104; d; 3; 249; 129; 10; 21; 210; 40
112; e; 22; 230; 146; 8; 18; 225; 34
120; f; 9; 255; 144; 1; 20; 240; 36
127; g; 8; 255; 129; 3; 18; 255; 36
135; h; 8; 246; 136; 6; 19; 270; 34
143; i; 6; 233; 142; 7; 20; 285; 37
151; j; 18; 225; 131; 5; 20; 300; 33
159; k; 24; 236; 140; 10; 19; 315; 36
167; l; 7; 240; 137; 6; 22; 330; 30
175; m; 25; 229; 124; 4; 18; 345; 35
183; n; 25; 233; 146; 9; 18; 360; 35
211; o; 17; 254; 142; 0; 18; 375; 32
218; p; 10; 254; 138; 1; 21; 390; 32
224; q; 25; 243; 132; 2; 22; 405; 30
232; r; 8; 242; 135; 4; 20; 420; 32
239; s; 26; 239; 143; 10; 22; 435; 37
245; t; 22; 248; 147; 4; 18; 450; 30
252; v; 14; 237; 143; 5; 20; 465; 36
FALSE; w; 6; 243; 136; 3; 22; 480; 38
FALSE; x; 28; 246; 150; 9; 22; 495; 34
FALSE; y; 22; 247; 142; 8; 18; 510; 39
FALSE; z; 0; 232; 133; 3; 21; 525; 34
$c is the returnValue of colorallocate function, $char is the current
character, $r,$b,$g -> red,green,blue, $a -> angle, $s -> font size,
$l,$t -> font left and top.
As you see, the returnValue of the colorallocate function behaves very
strange.
------------------------------------------------------------------------
[2008-11-02 23:12:50] laszlo dot janszky at gmail dot com
Nah I wrote wrong code in my previous comment, here is the right one:
$c=imagecolorallocate($image,$r,$b,$g);
if (!$c)
{
echo($r.','.$b.','.$g.'<br>');
}
imagettftext($image,$s,$a,$l,$t,$c,'xfont.ttf',$char);
------------------------------------------------------------------------
[2008-11-02 23:09:02] laszlo dot janszky at gmail dot com
http://hu.php.net/imagecolorallocate
I had read the documentation before I sent the report. I wrote an if in
my code like this:
$c=imagecolorallocate($image,$r,$b,$g);
imagettftext($image,$s,$a,$l,$t,$c,'xfont.ttf',$char);
$c was false, but the $r,$b,$g parameters were valid, and they weren's
the same as the background.
I checked it with another ttf file, but nothing changed.
I'll check it tomorrow without rand manually, but I'm afraid it's
caused by that function.
------------------------------------------------------------------------
[2008-11-02 22:23:42] [EMAIL PROTECTED]
what about checking the colors you get? Like the random values may be
duplicated or ends using the bg color.
There is no bug in either the ttf or the color function. Try to
predefine the colors to verify it.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/46466
--
Edit this bug report at http://bugs.php.net/?id=46466&edit=1