ImageColorAllocate Problem
| From: | Kevin | Date: | Sat, 31 Jul 2004 19:07:59 +0000 |
| Subject: | ImageColorAllocate Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192416@lists.php.net to get a copy of this message | ||
Hi there,
I am having a problem in ImageColorAllocate function. I am using this
function in a loop. After some number of looping the function starts
returning -1 value. I am attaching my code below. Can any one help me with
this?
<?php
header("Content-type: image/png");
// create a 100*30 image
$im = imagecreate(300, 300);
// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$j=0;
for($i=1;$i<=30;$i++)
{
$textcolor = imagecolorallocatealpha($im, $i*2, $i*3, $j, 0);
// write the string at the top left
imagestring($im, 5, 0, $j, "Hello world!", $textcolor);
//imagecolordeallocate($im,$textcolor);
$j=$j+10;
}
// output the image
imagepng($im,"try.png");
?>
Thanks for reading this far.
Kevin.