CyberD.org
C:\ Home » Code » WordPress HTTP Error Uploading Images [FIX]

WordPress HTTP Error Uploading Images [FIX]

So, lately I've been occasionally bugged by an HTTP error when uploading images. At first I didn't think much of it, I thought there was something wrong with the image file, so I ran it through FastStone Photo Resizer (a program I use to compress/resize most images I upload) and that fixed the problem. Many days passed.

Then today I was about to post about a new pair of shoes and the error popped up in a red box. I had already resized the picture, and sizewise it was down at 418kb, so there should be no problem with the file. I tried uploading a few times, and each time it got stuck at 92%. I tried uploading the original file (around 2MB) and it got stuck at 99%. At this point I was thinking there was some problem at the end of the file (EXIF camera information maybe?) since I hadn't uploaded a photo in a while, but then I tried making the file a LOT smaller (10%), and it uploaded fine!

I checked support threads and people spoke about the Smushit plugin giving the same error, but I don't have that plugin installed (no sense in resizing the image after upload, I do that before uploading). I checked my plugins anyway, to see if any of them were suspicious, and then I checked my error_log. Guess what, exhausted memory limit was the error. I found a bunch of other plugins misbehaving too, but that's outside the post, the exhausted memory limit was easy to fix, and I'm surprised I haven't 'fixed' it earlier! Maybe my host didn't allow modification of the PHP RAM limit earlier. Anyway, the fix is this:

define('WP_MEMORY_LIMIT', '32M');

Just add that to the wp-config.php file. That's it. You could change the .htacess file or the php.ini file too, it'll do the same thing. I tried uploading again after this quick edit and the error was swept away. I might be imagining things, but I feel like the site overall is a bit faster too. Maybe this will even get rid of those occasional pesky 502 errors that sometimes bother me! Maybe this tip is useful for some other lost soul looking to fix their HTTP errors. If you didn't know it, now you know. :)

Comments

Keep track of the discussion via rss? Read about comment etiquette? Or type in something below!
This was pretty damn interesting. And yet, nobody's spoken! Be the first!


The Comment Form

Your email address will not be published. Required fields are marked *

Your email is saved only to approve your future comments automatically (assuming you really are a human). ;) It's not visible or shared with anyone. You can read about how we handle your info here.

Question   Smile  Sad   Redface  Biggrin  Surprised   Eek  Confused  Beardguy  Baka  Cool  Mad   Twisted  Rolleyes   Wink  Coin

Privacy   Copyright   Sitemap   Statistics   RSS Feed   Valid XHTML   Valid CSS   Standards

© CyberD.org 2024
Keeping the world since 2004.