$width) { $dst_w = ($newImageWidth - $width)/2; } if ($newImageHeight > $height) { $dst_h = ($newImageHeight - $height)/2; } if ($dst_w > 0) { imagecopyresampled($newImage,$source,$dst_w,$dst_h,$start_width,$start_height,$width,$height,$width,$height); } else { imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height); } switch($imageType) { case "image/gif": imagegif($newImage,$thumb_image_name); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": imagejpeg($newImage,$thumb_image_name,100); break; case "image/png": case "image/x-png": imagepng($newImage,$thumb_image_name); break; } } return $thumb_image_name; } ?>