note 24641 deleted from function.imagecolorallocate by didou
| From: | didou@php.net | Date: | Fri, 15 Aug 2003 21:52:00 +0000 |
| Subject: | note 24641 deleted from function.imagecolorallocate by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54253@lists.php.net to get a copy of this message | ||
Note Submitter: faceman@flevonet.nl
----
No, it doesn't ... here a function I wrote:
function ImageColorAllocateHex( $image, $hex ) {
for( $i=0; $i<3; $i++ ) {
$temp = substr($hex, 2*$i, 2);
$rgb[$i] = 16 * hexdec( substr($temp, 0, 1) ) + hexdec(substr($temp, 1, 1));
}
$rgb = ImageColorAllocate ( $image, $rgb[0], $rgb[1], $rgb[2] );
return $rgb;
}
Call it like this:
ImageColorAllocateHex($IMG, "ff0000");
Have fun, PHPgroup should implement this..
Eric