taith Posted August 13, 2008 Share Posted August 13, 2008 is there a way of translating a hex into rgb format for the GD library? Link to comment https://forums.phpfreaks.com/topic/119503-solved-gd-library-hex/ Share on other sites More sharing options...
taith Posted August 13, 2008 Author Share Posted August 13, 2008 :-P found my own answer thanks anyways :-) function hex_to_rgb($hex){ if(substr($hex,0,1) == '#') $hex = substr($hex,1) ; if(strlen($hex) == 3) $hex = substr($hex,0,1).substr($hex,0,1).substr($hex,1,1).substr($hex,1,1).substr($hex,2,1).substr($hex,2,1); $rgb['red'] = hexdec(substr($hex,0,2)) ; $rgb['green'] = hexdec(substr($hex,2,2)) ; $rgb['blue'] = hexdec(substr($hex,4,2)) ; return $rgb ; } Link to comment https://forums.phpfreaks.com/topic/119503-solved-gd-library-hex/#findComment-615686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.