Support » Fixing WordPress » Image upload problem – "Fatal error: Out of memory" – but image has uploaded ok

  • Out of the blue, image upload started giving this message

    Fatal error: Out of memory (allocated 30146560) (tried to allocate 8220 bytes) in …../blog/wp-includes/media.php on line 254

    Which is a call to: imagecreatefromstring( file_get_contents( $file ) )

    Occasionally the reference is to line 1006, which is a call to: imagecreatetruecolor($width, $height)

    However, if I click the ‘Save all Changes’ button below the message, the file is displayed in Gallery and appears to be fine.

    Yesterday this happened with every image, today it’s happening with around 50%. I’ve checked the various files and there’s no difference in spec. In fact the same file will sometimes upload with an error and sometimes without.

    Any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi


    Forum Moderator

    Thanks for the suggestion. I don’t have access to php.ini, but the memory limit is set to 90MB and these files are small. Besides, it wasn’t a problem last week!




    Forum Moderator

    Then it could be an issue on your server. Try asking your hosts for assistance.

    Thanks, that sounds like a good idea!

    I have just come across the same issue. I’ve been running a blog for several years and have uploaded many images (mainly with max length of 700 px. In the last week, I have started getting the fatal error out of memory message, although some images process OK and others are rejected with the error – not always the largest image. The image size is around 100K. When I look at the host files, I see the original image plus all the smaller sized images, however, when I look in the media editor, only the full size image is shown with size of “0”. The failure is occurring at wp-includes/media.php on line 1025

    I have added the config.php line about memory, but no change there. What is strange is that this has just started happening.


    Also looking for a solution.

    Tried method suggested above without success

    What worked for me but needs testing:

    Deleted the “problem” images uploaded to the wp uploads folder.

    Reduced the width of image to match width of post (using 3rd party image editing software)

    In this case, reduced original image width from 800px width to 600px then uploaded again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Image upload problem – "Fatal error: Out of memory" – but image has uploaded ok’ is closed to new replies.