Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Image Gallery Fatal Error: Allowed memory size

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 5584 Views
  • Sophie
    Avatar
    Community Member
    33 Posts

    Image Gallery Fatal Error: Allowed memory size Link to this post

    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

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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...

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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?

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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...

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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');

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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...

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Image Gallery Fatal Error: Allowed memory size Link to this post

    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.

    5584 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.