note 50981 added to function.imagecolorallocate
| From: | mvatbrazildotcom at osu1 dot php dot net | Date: | Tue, 15 Mar 2005 19:34:31 +0000 |
| Subject: | note 50981 added to function.imagecolorallocate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86500@lists.php.net to get a copy of this message | ||
<?
/**
* Create a image bar using lib GD
* Ege. <img src="color_sample.php?color=FF0000" width="10
height="30">
*/
// Split the HTML color representation
$hexcolor = str_split($_GET["color"], 2);
// Convert HEX values to DECIMAL
$bincolor[0] = hexdec("0x{$hexcolor[0]}");
$bincolor[1] = hexdec("0x{$hexcolor[1]}");
$bincolor[2] = hexdec("0x{$hexcolor[2]}");
$im = ImageCreate(100, 100);
$colorallocate = ImageColorAllocate($im, $bincolor[0], $bincolor[1], $bincolor[2]);
ImageFilledRectangle($im, 0, 0, 100, 100, $colorallocate);
header('Content-Type: image/png');
ImagePNG($im);
?>
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorallocate.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50981
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50981&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50981&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50981&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50981&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50981&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50981&report=yes
Search -- http://master.php.net/manage/user-notes.php