note 44919 deleted from function.imagecolorallocate by danbrown

From: Date: Fri, 24 Apr 2009 12:51:50 +0000
Subject: note 44919 deleted from function.imagecolorallocate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153671@lists.php.net to get a copy of this message
Note Submitter: avi at amarcus dot com ---- quote from "tim at phantomrpg dot com" Here is a simpler way of using a hex color with ImageColorAllocate(). sscanf("FFFF00", "%2x%2x%2x", $red, $green, $blue); $stringColor=ImageColorAllocate($image,$red,$green,$blue); I made it into a simple function: <?php function fromhex($string){ GLOBAL $image; sscanf($string, "%2x%2x%2x", $red, $green, $blue); return ImageColorAllocate($image,$red,$green,$blue); } //Example for calling a hex color: ImageFill($image, 0, 0, fromhex('FFFFFF')); ?>

« previous php.notes (#153671) next »