I have a script that is resizing an image that is being uploaded using the GD library. I am getting the following error when I try to upload an image that is 332k:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 8016 bytes) in /var/www/html/shop/oneofakind/classes/Thumbnail.class.php on line 177
I know many people on this forum have had the same issue, and simply adjusted their php.ini file to increase memory_limit to allow more meory for the process.
I did this too, adjusting memory_limit to a whopping 200M and the error still persists. I realize GD has to have a good chunk of memory to do the image processing on the fly, but it seems to be over kill here. The wierd thing is that the error is still indicating that the defualt 8M memory_limit has been exceded, meaning it is somehow not recognizing the memory allocation shift. A phpinfo() page tells me it has been recognized, though.
What shall I do?
// Instantiate Thumbnail Class
$thumb = new Thumbnail($_FILES['photo']['tmp_name']);
$thumb->size_auto(200);
$thumb->output_format='JPG';
$thumb->process();
// Store resized image
if( $thumb->save("/var/www/html/about/artists/images/".$photo) == 0 ){
$err .= "Error Saving Thumbnail<br />";
}