Hello. I've been working on a problem (on and off) for about a week and a half now. Here is my situation: I have HUGE jpg's that are being uploaded to the server (i.e. - 5700px by 7200px). The following script works for images about half that size or smaller. The script dies on the massive images, but it is vital that there be thumbnails.
Help! What do I do?
//get img size
list($width, $height) = getimagesize($originalFile);
//*******************************
//** Create Preview Img
//*******************************
if( !file_exists($previewFile) ){
//new size
if( $width > $height ){
$newWidth = 300;
$newHeight = 300 / $width * $height;
}else{
$newHeight = 300;
$newWidth = 300 / $height * $width;
}
//load
$output = imagecreate($newWidth, $newHeight);
$source = imagecreatefromjpeg($originalFile);
//copy
imagecopyresized($output, $source, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
//output
imagejpeg($output, $previewFile);
}