Below is the code I am using to upload a file and then resize it. The code is taken from php.net
<?php
copy ( $filename, "$file_dir/$id/$albumName/$filename_name" ) or die ("Couldn't copy");
// The file
$imagefile = "$file_dir/$id/$albumName/$filename_name";
// Set a maximum height and width
$width = 600;
$height = 600;
// Content type
// header('Content-type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($imagefile);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($imagefile);
imagecopyresampled($file_dir/$id/$albumName/$image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
?>
And this is the error message I get when the above code is run:
Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 12032 bytes) in /home/fhlinux197/r/rupstar.com/user/htdocs/fotoshow/resample600.php on line 25
Does anyone have any idea why this is happening and what this error message means?
Many thanks for you help in advance.
Rupert