hi. a script i edited works for jpegs, and only jpegs. will work on gifs and png as long as i ultimately convert them to jpgs. what im wondering is why it is not working for gifs and png files. here is the relevant code:
// Content type
if($extension == 'jpg' || $extension == 'jpeg'){
header('Content-type: image/jpeg');
} else if($extension == 'gif') {
header('Content-type: image/gif');
} else if($extension == 'png'){
header('Content-type: image/png');
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
if($extension == 'jpg' || $extension == 'jpeg'){
$image = imagecreatefromjpeg($file);
} else if($extension == 'gif') {
$image = imagecreatefromgif($file);
} else if($extension == 'png'){
$image = imagecreatefrompng($file);
}
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
if($extension == 'jpg' || $extension == 'jpeg'){
imagejpeg($image_p, null, 80);
} else if($extension == 'gif') {
imagegif($image_p, null);
} else if($extension == 'png'){
imagepng($image_p);
}