Hi...
okay I just have a simple upload and resize image for thumbnail code...and it works okay..my problem is.. if I'm uploading a transparent *.gif image it will create a black bg color for thumnail image..and for the original image as well..so is there any solution to this ..I mean I want the image and the thumbnail still remain transparent when the uploading process done...not fill in the bg with black color..like what I have just now ...so i really need help with it...
here's the code I'm using..
<?
//error_reporting(E_ALL);
//Upload------------------------------------
if($_POST['Submit']){
if ($_FILES['imagefile']['type'] == "image/gif"){
copy ($_FILES['imagefile']['tmp_name'], "images/".$_FILES['imagefile']['name']) or die ("Could not copy");
echo "";
}else {
echo "<br><br>";
echo "bad file type (".$_FILES['imagefile']['name'].")<br>";
exit;
}
//-----upload end
//------start thumbnailer
$thumbsize= 50;
$imgfile = "images/$imagefile_name";//processed image
header('Content-type: image/gif');
list($width, $height) = getimagesize($imgfile);
$imgratio=$width/$height;
if ($imgratio>1){
$newwidth = $thumbsize;
$newheight = $thumbsize/$imgratio;}
else{
$newheight = $thumbsize;
$newwidth = $thumbsize*$imgratio;
}
$thumb = ImageCreateTrueColor($newwidth,$newheight);
$source = imagecreatefromgif ($imgfile);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagegif($thumb,"thumbs/$imagefile_name",100);
//-----------end--------------
}
?>
thanks