note 44919 added to function.imagecolorallocate

From: Date: Fri, 20 Aug 2004 06:21:57 +0000
Subject: note 44919 added to function.imagecolorallocate
Groups: php.notes 
Request: Send a blank email to php-notes+get-74969@lists.php.net to get a copy of this message
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')); ?> ---- Manual Page -- http://www.php.net/manual/en/function.imagecolorallocate.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44919 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44919&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44919&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#74969) next »