ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

File Uploads - Fatal Error: Out of Memory?

July 25, 2014 8:49am

Subscribe [4]
  • #1 / Jul 25, 2014 8:49am

    jondaiello

    15 posts

    I’m encountering some weird issues when trying to upload images through the native ExpressionEngine file manager.

    First I encountered this at the native size of the jpg file (678kb, 2550px x 3300px):

    Fatal error: Out of memory (allocated 34340864) (tried to allocate 10200 bytes) in /[confidential]/manage/codeigniter/system/libraries/Image_lib.php on line 1246

    After editing the file in Photoshop and down sizing (350kb, 2040px x 2640px) I receive this error:

    A PHP Error was encountered
    Severity: Warning
    
    Message: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error:
    
    Filename: libraries/Image_lib.php
    
    Line Number: 1246
    
    A PHP Error was encountered
    Severity: Warning
    
    Message: imagecreatefromjpeg(): '/[confidential]/uploads/blog/2nd-qtr-2014-sponsorship-news_01-300kb.jpg' is not a valid JPEG file
    
    Filename: libraries/Image_lib.php
    
    Line Number: 1246
    
    A PHP Error was encountered
    Severity: Warning
    
    Message: Cannot modify header information - headers already sent by (output started at /[confidential]/manage/codeigniter/system/core/Exceptions.php:170)
    
    Filename: core/Common.php
    
    Line Number: 442

    I confirmed the upload directory and thumbnail directories are both set to 777.

    Then I again adjusted the file size even smaller (230kb, 1530px x 1980px) and a successful upload was achieved.

    An obvious solution would be to save every file smaller than 2000px, and 230kb or less, but there are a lot of existing files that we are trying to copy over.

    The problem is that even if we FTP upload, then syncing the upload directories through EE’s File Manager, the files still don’t appear in File Manager.

    Any help is appreciated!

    Setup:
    • ExpressionEngine Core v2.9.0 - Build Date: 20140715
    • PHP memory_limit = 120M
    • Upload directories set to 777.

  • #2 / Jul 28, 2014 12:16pm

    Giraffentoast

    152 posts

  • #3 / Jul 28, 2014 12:21pm

    jondaiello

    15 posts

    I think I’ve ruled that out. I’ve taken the image into Photoshop, edited it, and re-saved it as a new file. This should produce a valid file. Even with that done, I still get the error with the largest size of the image (which appears to be well below the limit of 40M as listed in the file manager area.)

  • #4 / Jul 28, 2014 12:28pm

    jondaiello

    15 posts

    I’ve done another round of tests, and it appears that any image that has a dimension of 2000px or greater causes the upload to fail and EE renders the errors.

    I’ve attached the images I’ve used as my test subjects. All images are under 40kb in size, however they range in file dimensions from 1750px x 1750px all the way up to 3000px x 3000px.

    Any suggestions?

  • #5 / Jul 28, 2014 12:32pm

    Giraffentoast

    152 posts

    Check your phpinfo().

    max_file_uploads?
    post_max_size?
    upload_max_filesize?

  • #6 / Jul 28, 2014 12:36pm

    Giraffentoast

    152 posts

    Check your File Upload Preferences.

    Maximum File Size (in bytes)?
    Maximum Image Width (in pixels)?
    Maximum Image Height (in pixels)?

  • #7 / Jul 28, 2014 1:04pm

    jondaiello

    15 posts

    PHP:
    max_file_uploads = 20
    post_max_size = 8M
    upload_max_filesize = 40M

    EE:
    Maximum File Size (in bytes) = empty
    Maximum Image Width (in pixels) = empty (And tried set to 3500px)
    Maximum Image Height (in pixels) = empty (And tried set to 3500px)

    The file appears to upload, but EE seems to fail anytime it tries to access it.

    I have even uploaded via FTP, and tried to sync the file manager, and EE refuses to see the file.

  • #8 / Jul 29, 2014 3:42am

    Giraffentoast

    152 posts

    So maybe it really is a GD lib problem.

    Try uploading an image you created with aproximately the same file size. Does that work?
    If yes, your JPG might really be corrupt.

  • #9 / Jul 29, 2014 3:48am

    muabancanho

    6 posts

    thanks admin , I done!

  • #10 / Jul 29, 2014 7:13am

    jondaiello

    15 posts

    I’ve ruled out the JPG being corrupt. I created a new blank photoshop file (attached above), and saved it out as different JPGs at different sizes. Anything 2000px or greater in dimension fails. All the rest work.

  • #11 / Jul 29, 2014 10:06am

    Rob Allen

    3118 posts

    It looks as if your server is running out of memory and doesn’t have enough to process the larger images. Try bumping memory up to 64mb or 128mb - that should do the trick.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases