We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17717
    • 433 Posts
    Hi all,

    I have problems uploading images over with a file size of 1.2MB. I get the following error:


    Fatal error: Allowed memory size of

    Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 8192 bytes) in /home/site/public_html/assets/snippets/maxigallery/watermark/Thumbnail.class.php on line 183

    I have set the max upload size in the php.ini file to 16MB but still no joy.

    Can anyone help?

    Thanks
      http://www.blend.uk.com | Web Design by Blend
      • 7923
      • 4,213 Posts
      max upload size is not the memory limit, it’s max upload size.


      Check these values from php.ini:

      max_execution_time, this is the maximum execution time allowed for each script, in seconds (it takes quite some time for maxigallery script to process the images if there are many of them and many imaging "filters" used).
      max_input_time, this is the maximum time each script may spend parsing request data, in seconds.
      memory_limit, this is the maximum amount of memory in megabytes that a script may consume (maxigallery keeps the images in memory while it makes thumbnails etc).
      post_max_size this is the maximum size of POST data in megabytes that PHP will accept (the pictures travel in the post data).
      upload_max_filesize this is the maximum allowed size for uploaded files in megabytes.

      These settings can also be configured from Apache, so you might want to see if the following can be found from your httpd.conf:

      php_admin_value upload_max_filesize Sets the corresponding php setting, see above.
      php_admin_value post_max_size Sets the corresponding php setting, see above.
      php_admin_value memory_limit Sets the corresponding php setting, see above.
      LimitRequestBody Same as post_max_size php setting, but for apache.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 8960
        • 150 Posts
        I’m having the same type of issue. My original images are 3456x2304 @ 1.4meg. Right now, I have to reduce them to 2900x???? which brings the size down to 1meg.

        My php.ini settings seem within reason, but I’m still having these errors.
        max_execution_time: 60
        max_input_time: 60
        memory_limit: 32
        post_max_size: 8M
        upload_max_filesize: 10M

        Here’s the error code I’m getting:
        Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3456 bytes) in /assets/snippets/maxigallery/watermark/Thumbnail.class.php on line 183

        I’m not even using the watermark feature, but I am using the thumbnails. Are there other Maxigallery settings I should check/adjust?
          • 7923
          • 4,213 Posts
          Needed memory is about 5 times the image size. So in your case it would be 3456x2304x5 = 39,8MB

          Try setting a bigger memory_limit value or resize the picture to a smaller size before uploading.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 8960
            • 150 Posts
            Quote from: doze at Apr 28, 2008, 02:01 AM

            Try setting a bigger memory_limit value or resize the picture to a smaller size before uploading.

            To do that, I’ll have to use a separate php.ini file with the new setting. Do I need to put this in the MaxiGallery folder, the folder where the upload PHP is being called, or does it need to go in the site’s root folder?
              • 7923
              • 4,213 Posts
              Usually the custom php.ini is kept outside the document root (eg. outside public_html folder) in the root of your www domain account. You might want to ask your host for the correct place.


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 8960
                • 150 Posts
                Here’s what I tried: I put a php.ini file in the public_html folder with this line
                php_memory_limit = 64M
                which didn’t work, so I tried this line
                memory_limit = 64
                which also didn’t work.

                Placing this php.ini file in the public_html caused weird things to happen when vieing the site and when logged into the Manager. When I was logged into the Manager, it kept logging me out anytime I clicked on anything. When I was on the frontend of the website, it wouldn’t see that I was logged in at all. My settings may not have been correct above, but I had the same behavious happen when I had a blank php.ini sitting there, as well.

                I also tried placing the php.ini in the folder above public_html and that seemed to have no affect at all.

                Any thoughts?
                  • 37272
                  • 216 Posts
                  I think you misread Doze’s reply (unless I’m misreading it). You should place the php.ini life in you in the www directory or maybe in the manager directory.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    php.ini files do not cascade, nor are they inherited from folder to subfolder. You need to have one in every folder where the directive needs to be used.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org