richy
Sep 20th, 2009, 09:17 AM
I have the below code using GD 2.0.34:
The jpg setting works as expected, but for some reason the gif version isn't filling anything in when outputting but I can't work out why. Anyone got any thing to try as I'm completely out of ideas. Basically all the code should do would be to output the following squares to red.
http://79.170.40.234/richant.co.uk/test.jpg
http://79.170.40.234/richant.co.uk/test.gif
<?php
$type="gif";
$im = imagecreatetruecolor(120,20);
$red = imagecolorallocate($im, 255, 0, 0);
if($type=="jpg")
{
$image = imagecreatefromjpeg('test.jpg');
imagefill($image, 29, 45, $red);
header('Content-type: image/jpeg');
imagejpeg($image);
}
elseif($type=="gif")
{
$image = imagecreatefromgif('test.gif');
imagefill($image, 29, 45, $red);
header('Content-type: image/gif');
imagegif($image);
}
imagedestroy($image);
?>
Thanks in advance.
The jpg setting works as expected, but for some reason the gif version isn't filling anything in when outputting but I can't work out why. Anyone got any thing to try as I'm completely out of ideas. Basically all the code should do would be to output the following squares to red.
http://79.170.40.234/richant.co.uk/test.jpg
http://79.170.40.234/richant.co.uk/test.gif
<?php
$type="gif";
$im = imagecreatetruecolor(120,20);
$red = imagecolorallocate($im, 255, 0, 0);
if($type=="jpg")
{
$image = imagecreatefromjpeg('test.jpg');
imagefill($image, 29, 45, $red);
header('Content-type: image/jpeg');
imagejpeg($image);
}
elseif($type=="gif")
{
$image = imagecreatefromgif('test.gif');
imagefill($image, 29, 45, $red);
header('Content-type: image/gif');
imagegif($image);
}
imagedestroy($image);
?>
Thanks in advance.