I have a script that resizes uploaded images. It works fine for PNGs and JPGs but not GIFs. For the GIFs, it's supposed to convert them into JPGs and then resize them. The conversion works, but then they fail to be resized...
function resize_image($file, $maxWidth, $maxHeight) {
$jpgFile = substr_replace($file, 'jpeg', -3);
$fileType = strtolower(substr($file, -3));
...
if ($fileType == 'gif') {
$test = imagecreatefromgif($file);
imagejpeg($test, $jpgFile);
$src = imagecreatefromjpeg($jpgFile);
$dst = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
imagejpeg($dst, $jpgfile);
}
}