/ Published in: PHP

This function will allow you to use '#ABCDEF' or '0xEEFF33' instead of the RGB values required for imagecolorallocate() by stripping away any non hex characters. It will also check and make sure that it's a valid 6 digit hex value after the stripping of non-hex characters takes place.
it simply uses the function hexdec() to convert each R, G, and B hex values to decimal, and then passes them to imagecolorallocate() individually.
See the page: http://us3.php.net/imagecolorallocate
to learn how to use this wrapper function.
it simply uses the function hexdec() to convert each R, G, and B hex values to decimal, and then passes them to imagecolorallocate() individually.
See the page: http://us3.php.net/imagecolorallocate
to learn how to use this wrapper function.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function img_colorallocate($img, $color) { // strip away any non hex characters, to allow flexibility with the function } $img, ); return $color; }
URL: http://jacolyte.com
Comments
