note 96798 added to function.imagecolorallocate

From: Date: Tue, 16 Mar 2010 18:17:10 +0000
Subject: note 96798 added to function.imagecolorallocate
Groups: php.notes 
Request: Send a blank email to php-notes+get-167100@lists.php.net to get a copy of this message
Two useful functions for converting color from imageColorAllocate. <?php /** * Convert color from imageColorAllocate() to hex in XXXXXX (eg. FFFFFF, 000000, FF0000) * * name: color2rgb * author: Yetty * @param $color value from imageColorAllocate() * @return string; color in style XXXXXX (eg. FFFFFF, 000000, FF0000) */ function color2rgb($color) { return str_pad(base_convert($color, 10, 16), 6, 0, STR_PAD_LEFT); } /** * Convert color from hex in XXXXXX (eg. FFFFFF, 000000, FF0000) to array(R, G, B) * of integers (0-255). * * name: rgb2array * author: Yetty * @param $color hex in XXXXXX (eg. FFFFFF, 000000, FF0000) * @return string; array(R, G, B) of integers (0-255) */ function rgb2array($rgb) { return array( base_convert(substr($rgb, 0, 2), 10, 16), base_convert(substr($rgb, 2, 2), 10, 16), base_convert(substr($rgb, 4, 2), 10, 16), ); } ?> ---- Server IP: 147.32.160.17 Probable Submitter: 94.74.221.242 ---- Manual Page -- http://www.php.net/manual/en/function.imagecolorallocate.php Edit -- https://master.php.net/note/edit/96798 Del: integrated -- https://master.php.net/note/delete/96798/integrated Del: useless -- https://master.php.net/note/delete/96798/useless Del: bad code -- https://master.php.net/note/delete/96798/bad+code Del: spam -- https://master.php.net/note/delete/96798/spam Del: non-english -- https://master.php.net/note/delete/96798/non-english Del: in docs -- https://master.php.net/note/delete/96798/in+docs Del: other reasons-- https://master.php.net/note/delete/96798 Reject -- https://master.php.net/note/reject/96798 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167100) next »