note 24641 added to function.imagecolorallocate

From: Date: Fri, 23 Aug 2002 20:04:17 +0000
Subject: note 24641 added to function.imagecolorallocate
Groups: php.notes 
Request: Send a blank email to php-notes+get-35421@lists.php.net to get a copy of this message
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 -- http://www.php.net/manual/en/function.imagecolorallocate.php http://master.php.net/manage/user-notes.php?action=edit+24641 http://master.php.net/manage/user-notes.php?action=delete+24641 http://master.php.net/manage/user-notes.php?action=reject+24641

« previous php.notes (#35421) next »