I have a script that creates a bargraph, now it all works great until setting the colours to be used, even when a colour is chosen it sets it to greyscale.
here is some of the code:
extract($_GET);
//-----------------------------------------------
$txtcnt = $width;//keep original percentage before changing width for image
$maxwidthmultiplier = 2;//multiplication to increase width by: 50 becomes 100, 17 becomes 34
//while ($width < 100) {//increase width
$width = $width * $maxwidthmultiplier;//increase width by $maxwidth
//}
//create image...
$image = imagecreate($maxwidth,$height);
//allocate colours...
$barcolour = imagecolorallocate($image,$decbarcolour[0],$decbarcolour[1],$decbarcolour[2]);
$bordercolour = imagecolorallocate($image,$decbordercolour[0],$decbordercolour[1],$decbordercolour[2]);
$textcolour = imagecolorallocate($image,$dectextcolour[0],$dectextcolour[1],$dectextcolour[2]);
$remaincolour = imagecolorallocate($image,$decremaincolour[0],$decremaincolour[1],$decremaincolour[2]);
//draw borders...
//use rectangle instead (can be used for shadows :)
imagefilledrectangle($image,0,0,$width,$height,$bordercolour);
//create remaining percentage bar
imagefilledrectangle($image,0,0,$maxwidth,$height,$remaincolour);
//draw rectangle
imagefilledrectangle($image,1,1,($width - 2),($height - 2),$barcolour);
//output text
imagestring($image,4,($maxwidth/2.8),($height/5),$txtcnt.'%',$textcolour);
//output image
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);