Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Image memory size issue on small images

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 2347 Views
  • JohnHughes
    Avatar
    Community Member
    8 Posts

    Image memory size issue on small images Link to this post

    I have an image of less than 1000x700 in size.

    If I attempt to insert this image into the body of the blog article using the Upload File link in the Image Editor, I get a memory limit error. (Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 17520 bytes) in /home/stripe/public_html/sapphire/filesystem/GD.php on line 32)

    If I use this same photo as the main image for the blog article, I can upload and use without error.

    If I go to Files & Images, I can upload without error and then insert the image into the body of the blog article.

    _ONLY_ when attempting to upload from the Image Editor, do I get this error.

    Can someone offer an explanation?

    Attached Files
  • honeybunny
    Avatar
    Community Member
    79 Posts

    Re: Image memory size issue on small images Link to this post

    The last time this issue came up it was suggested that the problem was caused by the way that the image is resampled. I believe the solution was to increase php memory. For what it's worth, I wouldn't call a 1000 X 700 image small. If it's just an image for an article and not a screen sized splash graphic you could really go down in size quite a bit without losing any clarity. Though I did upload a 1220 X 600 gif in the image gallery yesterday without incident, I try to keep my article pics within a 150 - 250px range and almost never have a problem.

    HB

  • JohnHughes
    Avatar
    Community Member
    8 Posts

    Re: Image memory size issue on small images Link to this post

    1. PHP memory_limit is set at 64M

    2. Why does the problem only occur when using the Image Upload function used in the WYSIWYG editor? The limit does not come into play with other methods of uploading and resizing.

  • honeybunny
    Avatar
    Community Member
    79 Posts

    Re: Image memory size issue on small images Link to this post

    I don't have the greatest grasp on how php utilizes resources and I'm not really sure why php memory came into play, but when I had this problem last year I was told it was most likely because of php memory. I was in a hurry and didn't have time to look into it, but my quick fix was to simply make a new directory each month so that pics uploaded through the upload function in the wysiwyg editor so that there were a limited number of pics in one folder. They were still in the assets directory, but different sub-directories. It didn't really make sense, I mean the asset folder still contained all the uploaded files, but I never got the error message again so it seemed to work.

    HB

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Image memory size issue on small images Link to this post

    As a developer who builds and updates a number of SS sites using images extensively, I've run into this problem more times than I care to count. Here are the fixes I've employed in the past:

    - Increase PHP memory, 64M at least. I have my sites set to 128M. Most shared hosts only allow you to go as high as 64 by default, so you will need a dedicated or dedicated-virtual server to bump it even higher.

    - Resample your images before uploading. 120dpi or less is best. Anything over usually trips the memory error. Doesn't matter if your image is only 1000x700 big... I've had images of these dimensions trip the error anyways, because they had print quality resolutions such as 300dpi.

    The reason why you only get the warnings in certain places and not others is because in certain places, the upload function also performs some manipulation on the image before saving it, such as creating thumbnail sizes. You can tell by looking at the error message and seeing where it's coming from.. usually the GD library.

  • JohnHughes
    Avatar
    Community Member
    8 Posts

    Re: Image memory size issue on small images Link to this post

    Increased PHP.ini memory_limit to 128M and then inserted 1100x900 PNG image into blog article. Image was downsized to 600x491 as part of the embedding process.

    (This is on a dedicated server)

    2347 Views
Page: 1
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.