teebo Posted April 10, 2007 Share Posted April 10, 2007 Hi everyone, I have a simple script that resizes a JPG image and it seems that when the resolution (not the weight!) of the image is greater than 2000 x 1500, I get an annoying server error 500. At first I thought it could be a memory allocation error, but I tested an image at 3MB with a resolution of 300 x 300 and it works. Whereas the SAME image at 2200 x 1700 at 600KB fails. How can this be? Is there a way to resize an image without using imagecreatefromjpeg? Here is my script: $g_srcfile = 'Test.jpg'; // Get new sizes list($width, $height) = getimagesize($g_srcfile); // Load $thumb = imagecreatetruecolor(300, 300); $source = imagecreatefromjpeg($g_srcfile); // Resize imagecopyresampled($thumb, $source, 0, 0, 0, 0, 300, 300, $width, $height); // Output // Content type header('Content-type: image/jpeg'); imagejpeg($source); die(); Link to comment https://forums.phpfreaks.com/topic/46435-image-resizing-error/ Share on other sites More sharing options...
teebo Posted April 10, 2007 Author Share Posted April 10, 2007 I just tried ini_set('memory_limit','10M'); Gave me: Fatal error: Allowed memory size of 10485760 bytes exhausted (tried to allocate 3136 bytes) in /homepages/21/d164103623/htdocs/[domain]/PixAddNew.php on line 10 Line 10 being: $source = imagecreatefromjpeg($g_srcfile); Link to comment https://forums.phpfreaks.com/topic/46435-image-resizing-error/#findComment-225869 Share on other sites More sharing options...
scott_allen13 Posted April 15, 2007 Share Posted April 15, 2007 i am having this same problem... does anyone know why this happens? Link to comment https://forums.phpfreaks.com/topic/46435-image-resizing-error/#findComment-229813 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.