note 62457 deleted from function.imagecolorallocate by betz
| From: | betz@php.net | Date: | Wed, 01 Mar 2006 10:44:25 +0000 |
| Subject: | note 62457 deleted from function.imagecolorallocate by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104615@lists.php.net to get a copy of this message | ||
Note Submitter: dh
----
From my experience using the "imagecolorallocate" function,
the "resource image" parameter does not restrict to which
image the color should be applied to. Here is an example:
----------------------------------------------------------------
<?php
$image = imagecreatetruecolor(100,100);
$image1 = imagecreatetruecolor(100,100);
$image2 = imagecreatetruecolor(100,100);
$image3 = imagecreatetruecolor(100,100);
$some_color = imagecolorallocate($image, 96, 128, 160);
imagefilledrectangle($image1, 0, 0, 99, 99, $some_color);
imagefilledrectangle($image2, 0, 0, 99, 99, $some_color);
imagefilledrectangle($image3, 0, 0, 99, 99, $some_color);
imagegif($image1, "image1.gif");
imagegif($image2, "image2.gif");
imagegif($image3, "image3.gif");
imagedestroy($image);
imagedestroy($image1);
imagedestroy($image2);
imagedestroy($image3);
?>
----------------------------------------------------------------
By examining all three images created, it can be found that
they are all the same, which brings me back to my point.
What is the purpose of the image parameter if the color
allocated is not restricted to the image?