Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Image Gallery Fatal Error: Allowed memory size


Go to End
Reply


11 Posts   5659 Views

Avatar
Sophie

Community Member, 33 Posts

5 January 2010 at 2:28pm

Edited: 05/01/2010 2:28pm

I've read the other posts about this error, but am not clear about how I should trouble shoot this. My client uploaded some new images to her gallery and received this message:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 11312 bytes) in /home/content/c/a/t/host/html/sapphire/filesystem/GD.php on line 24

I took a look at all of the images she uploaded yesterday and appeared to be of a normal size. I noticed that all of the file name began with a dash, so I deleted all of the images she attempted to upload (from the gallery and from the folder in files & images); saved and flushed and still receive the above error message.

I'm not sure where to go with this short of getting rid of the gallery and rebuilding it. Advice would be appreciated!

Sophie

Avatar
klikhier

Community Member, 150 Posts

23 February 2010 at 10:18am

Edited: 23/02/2010 10:18am

Sophie, this issue occurs every now and then with my SilverStripe projects when clients upload images with a very high resolution (say, 6500 pixels x 4000 pixels). This might be your problem?!

All, is there a solution to this problem? Every now and then customers try to upload photo's with 6000+ pixel dimensions and this error occurs. Additionally: photo's can no longer be selected when adding images and the imagedom breaks. Please help. Changing the memory thing in htaccess doesn't change anything...

Avatar
UncleCheese

4085 Posts

23 February 2010 at 11:29am

Yeah, GD functions are notorious memory hogs. Not much you can do other than get your memory_limit increased. A couple ways to do it:

_config.php

ini_set('memory_limit','256M');

.htaccess

php_value memory_limit 256M

Avatar
Ryan M.

Community Member, 309 Posts

26 February 2010 at 9:05am

I just ran into this problem today and fixed it with UncleCheese's suggestions. However this seems to be a short term fix, and the ideal fix would be to fix the image processing itself.

Where should I begin?

Avatar
klikhier

Community Member, 150 Posts

26 February 2010 at 11:59pm

The fix suggested above doesn't work for my situation: Uploading an image with dimensions 8000x11000 pixels:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 33072 bytes) in /.../public_html/sapphire/filesystem/GD.php on line 22

I know that those dimensions are absurd, but currently I don't have a solution to prevent users from uploading such an image. So I'm with Ryan, although I'm not the hard-core programmer that's able to develop such improvements...

Avatar
UncleCheese

4085 Posts

27 February 2010 at 3:09am

Seriously, unless your users are uploading comps for billboards, there's no excuse for allowing an image of that size to be uploaded to your sever. You're playing with fire. Crank down your file size limit..

SWFUploadConfig::set_var('file_size_limit','2MB');

Avatar
klikhier

Community Member, 150 Posts

27 February 2010 at 3:35am

Thanks for your reply UncleCheese, however, I've got an image here that is below 2MB and still 6000px wide :( It's an export from CAD/CAM software...

Avatar
Ryan M.

Community Member, 309 Posts

27 February 2010 at 5:15am

Yeah, we need something which will detect the ridiculously large dimensions and halt the upload process. I talked to a sys admin friend of mine, he says it's because the GD library chokes on such a large number of pixels. Switching to ImageMagick or another image library is recommended, or in the very least, a limit on the image dimensions and file size.

Go to Top