I have encountered the following error:
path: /tmp/phpLds29k
name: IMG_1068.JPG
size: 590917 bytes
type: image/jpeg
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1600 bytes) in /home/fhlinux197/r/rupstar.com/user/htdocs/imageresize.php on line 27
I have the following script:
<?php
$file_dir = "/home/fhlinux197/r/rupstar.com/user/htdocs/";
$file_url = "http://www.rupstar.com/";
print "path: $fupload<br>\n";
print "name: $fupload_name<br>\n";
print "size: $fupload_size bytes<br>\n";
print "type: $fupload_type<p>\n\n";
// if ( $fupload_type == "image/pjpeg" )
// {
// START
// The file
// $filename = '$fupload';
// Set a maximum height and width
$width = 320;
$height = 320;
// Content type
// header('Content-type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($fupload);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($fupload);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
// END
copy ( $fupload, "$file_dir/$fupload_name" ) or die ("Couldn't copy");
// }
// else
// {
// if ( $image_p_type != "image/pjpeg" ){
// print "Invalid file type $image_p_type. Please submit only pjepg images (with extensions .jpg / .jpeg)";
// exit;
// }
// else
// {
// print "Failed - reason unknown.";
// exit;
// }
// }
?>
Line 27 reads:
$image = imagecreatefromjpeg($fupload);
Your help is much appreciated as always!!!!!
Rupert