So if you try and manipulate an images which is too big you get the following:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 19008 bytes) in /Library/WebServer/Documents/test/sites/all/modules/imageapi/imageapi_gd.module on line 123

Is there a check we can do before opening the image to know if it's going to request too much memory and exit with a nicer drupal error message?

Comments

pescetti’s picture

subscribing

hm2k’s picture

I have a solution which I would be willing to release which will help avoid these fatal errors.

I am accepting donations to fix this: http://tinyurl.com/hm2kpaypal

Repository: http://hm2k.googlecode.com/svn/trunk/code/php/functions/

hm2k’s picture

Version: 6.x-1.6 » 6.x-1.9
Category: task » bug

The function is here: http://hm2k.googlecode.com/svn/trunk/code/php/functions/image_memory_che...

The function helps catch and avoid errors such as this when processing images:
Fatal error: Out of memory (allocated xxxxxxxx) (tried to allocate xxxx bytes) in /home/xxx/public_html/sites/all/modules/imageapi/imageapi_gd.module on line 59

This is a bug because it's not acceptable for a module to expose a fatal error.