note 11530 deleted from function.imagecolorallocate by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 19:51:41 +0000 |
| Subject: | note 11530 deleted from function.imagecolorallocate by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22136@lists.php.net to get a copy of this message | ||
This seems to be true, although to prevent this kind of unexpected result, you'd normally use
an ImageFill before drawing anything else to explicitly set the bg color.
/* begin quote */
yaxinwen@eyou.com wrote at 09-Oct-2000 11:21:
It seems that the first color allocated in an image will be the background color.
Example:
<?php
Header("Content-type: image/gif");
$image = ImageCreate(200, 200);
$red = ImageColorAllocate($image, 255, 0,0);
$blue = ImageColorAllocate($image, 0, 0, 255);
ImageRectangle($image, 50, 50, 150, 150, $blue);
ImageGIF($image);
ImageDestory($image);
?>
You'll see a blue rectangle on a red background.
/* end quote */