• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Attachment Upload Fails Sometimes

owls8521

Active member
#1
I've been trying to attach pngs to my messages, but there are some pngs that won't upload. The bar gets stuck at 100%. They are all different dimensions and sizes, and I don't notice anything consistent about the ones that don't work. Here is the error that is showing up in the console in Google Chrome.

Invalid JSON: <br/> <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8000 bytes) in <b>/home/owls8521/explodingrabbit.com/forum/library/XenForo/Image/Gd.php</b> on line <b>77</b><br/>
 

Digital Doctor

Well-known member
#7
You are out of memory.
Reset the server and see if it goes away ... if it doesn't things look harder from there.
Some of these troubles might stem from the hackers :)
 

owls8521

Active member
#8
I rebooted the server and the problem still persists. So there is something wrong with my server? I guess I'll contact customer support for Dreamhost.
 

Digital Doctor

Well-known member
#9
Are you able to increase the size of the memory .... or shut down some processes ?
The host might be able to give you some more information about what is eating up the memory.
 

owls8521

Active member
#10
The memory problem only happens when I upload certain png files. Otherwise it seems fine. I have graphs that show me the memory and it is well below the limits.
 

Digital Doctor

Well-known member
#11
http://www.tech-recipes.com/rx/777/...memory-size-of-8388608-bytes-exhausted-tried/

You can also make this change permanently for all PHP scripts running on the server by adding a line like this to the server’s php.ini file:
memory_limit = 12M

of course that is too low for you ... you are running out at 134217728 bytes
memory_limit = 160M might work .... but that sure seems like alot.
This is a common problem that is for sure. [link].
 

Digital Doctor

Well-known member
#14
in Gd.php on line 77 .. see if there is something in there that restricts memory to a certain size.

This might help:
http://www.google.ca/#sclient=psy&h...c.r_pw.&fp=9ae63e6cb8d9c774&biw=1050&bih=1565

Try this first:

Make sure debug mode is off. Remove the debug line from the library/config.php file if you previously added it.

If you still get the error then you need to ask your host to increase or disable PHP's memory_limit.

You can also try changing the memory_limit yourself. These methods don't always work, but try adding this to your library/config.php file:
http://xenforo.com/community/threads/fatal-error-image-gd-php-on-line-56-upgrade-attachment.7604/
 

Digital Doctor

Well-known member
#17
XF sets the memory limit to 128M itself. You can set it in config.php:
ini_set('memory_limit', 256 * 1024 * 1024)

167772160 = 160 Megs.

ini_set('memory_limit', 160 * 1024 * 1024) or
ini_set('memory_limit', 167772160)

source
 

owls8521

Active member
#18
Yeah I saw that. I think it's happening because it's trying to create thumbnails for really big images and I guess that takes up a lot of memory. I'll just set a limit on the dimensions people can upload. I was trying to upload an image that was 8000 x 8000 pixels. I didn't know that uploading a higher resolution image used up more memory than a smaller one. I thought only the file size mattered.

Thanks for your help, Digital Doctor. I learned a lot.