note 62457 added to function.imagecolorallocate
| From: | dh at osu1 dot php dot net | Date: | Wed, 01 Mar 2006 04:55:12 +0000 |
| Subject: | note 62457 added to function.imagecolorallocate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104596@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 216.194.113.175
Probable Submitter: 24.239.159.20
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorallocate.php
Edit -- http://master.php.net/note/edit/62457
Del: integrated -- http://master.php.net/note/delete/62457/integrated
Del: useless -- http://master.php.net/note/delete/62457/useless
Del: bad code -- http://master.php.net/note/delete/62457/bad+code
Del: spam -- http://master.php.net/note/delete/62457/spam
Del: non-english -- http://master.php.net/note/delete/62457/non-english
Del: in docs -- http://master.php.net/note/delete/62457/in+docs
Del: other reasons-- http://master.php.net/note/delete/62457
Reject -- http://master.php.net/note/reject/62457
Search -- http://master.php.net/manage/user-notes.php