if($type == "image/jpeg"){
//create new jpeg image
$src = imagecreatefromjpeg($location);
$dst = imagecreatetruecolor($crop_width, $crop_height);
imagecopyresampled($dst, $src, 0, 0, $cropX, $cropY, $crop_width, $crop_height, $image_width, $image_height);
imagerotate($dst, $rotate, 0);
imagejpeg($dst, $location, 100);
//create jpeg thumb
$t_src = imagecreatefromjpeg($location);
$t_dst = imagecreatetruecolor($t_width, $t_height);
imagecopyresampled($t_dst, $t_src, 0, 0, 0, 0, $t_width, $t_height, $crop_width, $crop_height);
imagejpeg($t_dst, '../'.$uploads.'thumb_'.$imageFileName, 100);
} else if($type == "image/gif"){
//create new gif image
$src = imagecreatefromgif($location);
$dst = imagecreatetruecolor($crop_width, $crop_height);
imagecopyresampled($dst, $src, 0, 0, $cropX, $cropY, $crop_width, $crop_height, $image_width, $image_height);
imagerotate($dst, $rotate, 0);
imagegif($dst, $location, 100);
//create gif thumb
$t_src = imagecreatefromgif($location);
$t_dst = imagecreatetruecolor($t_width, $t_height);
imagecopyresampled($t_dst, $t_src, 0, 0, 0, 0, $t_width, $t_height, $crop_width, $crop_height);
imagegif($t_dst, '../'.$uploads.'thumb_'.$imageFileName, 100);
}
I changed it around so that it could do more and now i get a few errors. It makes the correct size image just it's black, meaning it obviously didn't resample.
Warning: imagecreatetruecolor(): Invalid image dimensions
Warning: imagecopyresampled(): supplied argument is not a valid Image resource
Warning: imagejpeg(): supplied argument is not a valid Image resource