[wp-hackers] Memory size error when uploading images

Christian Gundersson christian at buro2.se
Tue Mar 8 16:32:03 UTC 2011

Well, this issue get weirder still.

I tried using different images (same size) and they work, but not the
original images I tried with. Everytime I try I get the same issue as

Previously uploaded images (from january and beyond) work flawlessly in the
Media Gallery with all sizes represented, and all new images as well, exept
for the two images that cause the problem.

I'll try again with uploading the "problem" images but with a very small
size just to test.

(On a side note. The Web host limits all PHP scripts to 32MB by default.)

//Christian, Büro 2

2011/3/8 Adam Backstrom <adam at sixohthree.com>

> PHP was trying to allocate an *additional* 5004 bytes, which pushed it
> over the limit of 33554432 bytes.
> On Wed, Mar 2, 2011 at 12:28, Christian Gundersson <christian at buro2.se>wrote:
>> Hi!
>> I have a problem and can't seem to get the suggested solutions from the
>> internets to work. Anyone got a hint I'll be glad to listen...
>> I get the error below when I upload an image through the media library
>> (either directly or from within a post).
>> *Fatal error*: Allowed memory size of 33554432 bytes exhausted (tried to
>> allocate 5004 bytes) in *wp-includes/media.php* on line *254*
>> *
>> *
>> A very weird message since it tries to allocate a smaller amount than the
>> limit, but anyhew.
>> *
>> *
>> I've looked in the wp_postmeta table after uploading an image and the
>> entry
>> for _wp_attached_file is there and looking as it should. However, the
>> accompanying entry for _wp_attachment_metadata is missing. It feels as
>> though the upload procedure fails somehow but the image still gets
>> uploaded.
>> The codeline mentioned in the error message is
>> $image = imagecreatefromstring( file_get_contents( $file ) );
>> I can see the image in the media library and I can also attach it to
>> posts,
>> but only in it's full size. Previously uploaded images work like they
>> should, and between the last uploaded image that works and now the only
>> change is a WP upgrade from 3.0.3 to 3.1.
>> Any hints or pointers as to what could be causing this would be helpful.
>> The
>> support forum suggestions are not helping, neither is google...
>> I'm running WP 3.1 if it's of any interest. Sorry for the long post.
>> Regards
>> //Christian
>> *
>> *
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> --
> Adam Backstrom
> adam at sixohthree.com

More information about the wp-hackers mailing list