rray
11-24-2008, 04:03 PM
I am using PHP on a Host Monster web site. The line that causes a "Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10204 bytes). . ." is:
$src = imagecreatefromjpeg($ImageName);
This works fine on my PC, but not on HostMonster web site.
I have checked that the GD Library is functioning with the print_r(gd_info()) command. It is ok and supports jpeg files.
I have checked that the $ImageName file exists and is correct on Host Monster.
I have copied and pasted other similar scripts and they also bomb on the imagecreatefromjpeg line shown above with same error message.
Any suggestions??
PS: More of the script below.
if ($width >600 || $height>800) {
$src = imagecreatefromjpeg($ImageName); // Create an image so we can do the resize. This is the line that causes the Fatal Error:confused:
$tmp=imagecreatetruecolor($tn_width,$tn_height); // Create a GD-friendly temportary destination image
// this line actually does the image resizing, copying from the original image into the $tmp image
imagecopyresampled($tmp,$src,0,0,0,0,$tn_width,$tn _height,$width,$height);
// now write the resized image to disk.
imagejpeg($tmp,$newfilename,100); // 100 is best quality. $newfilename is path for new file.
unlink($ImageName); // deletes extra copied file in ../images dir.
imagedestroy($src);
imagedestroy($tmp);
}
$src = imagecreatefromjpeg($ImageName);
This works fine on my PC, but not on HostMonster web site.
I have checked that the GD Library is functioning with the print_r(gd_info()) command. It is ok and supports jpeg files.
I have checked that the $ImageName file exists and is correct on Host Monster.
I have copied and pasted other similar scripts and they also bomb on the imagecreatefromjpeg line shown above with same error message.
Any suggestions??
PS: More of the script below.
if ($width >600 || $height>800) {
$src = imagecreatefromjpeg($ImageName); // Create an image so we can do the resize. This is the line that causes the Fatal Error:confused:
$tmp=imagecreatetruecolor($tn_width,$tn_height); // Create a GD-friendly temportary destination image
// this line actually does the image resizing, copying from the original image into the $tmp image
imagecopyresampled($tmp,$src,0,0,0,0,$tn_width,$tn _height,$width,$height);
// now write the resized image to disk.
imagejpeg($tmp,$newfilename,100); // 100 is best quality. $newfilename is path for new file.
unlink($ImageName); // deletes extra copied file in ../images dir.
imagedestroy($src);
imagedestroy($tmp);
}