[wp-hackers] Memory size error when uploading images

Christian Gundersson christian at buro2.se
Wed Mar 2 17:28:15 UTC 2011


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.



More information about the wp-hackers mailing list