PDA

View Full Version : GD functions changing my colours.


MRMAN
01-26-2006, 05:41 PM
Hello I have this code


$filename = $_POST["checkbox"][$i];
$code = $_POST[$test];
$image = imagecreatefromgif(.$_POST["checkbox"][$i]);

$textheight =159;

$fontfile = "./arialbd.ttf";
$left = (218 / 2) - (strlen($code) * 17 / 2);

if($code)
{
$bgc = imagecolorallocate ($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 0, 0, 0);
imagefilledrectangle ($image, 2, 130, 215, 164, $bgc);
imagettftext($image, 25, 0, $left,$textheight, $text_color, $fontfile, $code);
}
imagegif($image, "$filename");
imagedestroy($image);



Everything works ok. I puts a white strip at the bottom of the image and inside the strip puts the text it typed from the previouse page.

The problem is on some images the colours are what i set i.e white strip black text. but on others they could be anything. i once had yellow on yellow.

If you need some images to show you what i mean i can do that.

Cheers

MRMAN