Error uploading profile photo (sometimes)

Hi to all! 

I have a problem with the photo profile upload, infact sometimes it works fine and sometimes it gave me this error:

I think depends from the dimension of the photo but where can I found the limit to edit it and to know what is this photo limit for the upload ?

Thanks !


I have tried a photo 1376*852 and works

I have tried a photo 1421*944 and works

I have tried a photo 1632*1224 and works

I have tried a photo 2609*1745 and doesn't works

I have tried a photo 3264*2448 and doesn't works


  • The GD php extension used for creating the thumbnails of profile images has a memory requirement that increases directly with the image dimensions of the uploaded image file. But the php variable memory_limit limits the memory available at maximum therefore causing an out-of-memory error if more memory is needed than allowed by memory_limit. Actually, there should be some check preventing the 500 error due to a too large image dimension but show a more meaningful error message instead. Not sure if this check might underestimate the memory requirement under some conditions or something else fails to work as expected.

    You can try with increasing the value set for memory_limit in Elgg's .htaccess file (e.g. increase the default value of 64M to 128M if the RAM available on your server allows it). Still, there will be some limit (at a higher resolution then) even with an increased memory_limit. It's just that the GD extension is doing the image resizing in a rather stupid way... The upcoming Elgg 3 will offer usage of an alternative image library (with a much lower memory requirement).

  • You might also have to increase one or two other php variables in .htaccess.

    upload_max_filesize sets the maximum allowed filesize for uploaded files. Though Elgg should show an error message telling about a file being too large if it increases the maximum allowed size.

    Then there's post_max_size that defines a limit for processing post data (in case of file uploads this includes also the size of the uploaded file itself plus possible copies / thumbnails created from it even if only temporarily). It's hard to catch situations with post_max_size too small, so you might want to increase it, e.g. to 64M, to see if it makes a difference.

  • I have done all you suggest but still doesn't works, i think i will put a message for users that says them to don't upload images that are over 1600x1200 dimension, until that works.