As you probably know by now, the WordPress Media Library is the host for all media on your site: from images, sound, videos to documents.
From time to time, the Media Library needs a little push to function properly. Common issues like:
- Plugin or theme incompatibility
- File permissions
can stop users from viewing or uploading their media.
In this article, I’m gonna take these issues one by one and provide you the solutions.
So, hop on!
WordPress HTTP Error When Uploading Images
This one used to drive me nuts. I mean…you’re spending 6 to 10 hours writing an article, and then, when you want to upload the images you see this:
It was like I was beginning to see the light at the end of the tunnel, and then, suddenly everything goes dark.
It seems that are two main reasons for this HTTP image loading error:
- A user error (wrong characters in the file name, etc.)
- WordPress and hosting issues (memory problems, third-party plugins, server issues – especially when you use shared hosting, etc.).
Now, let’s see what you can do in order to fix this.
- Check the extension of your images: make sure they are .jpg, .jpeg, .png, or .gif.
- Rename the images: avoid using weird characters.
- Refresh the browser: it works for me most of the time. I just need to do it a few times, leave it to rest a couple of minutes, et voilà, it works!
- Resize your files: if your business depends on high-resolution images (you’re a photographer, interior designer, etc.) then you can upload hi-res images. If not, my advice is to upload images under 200 KB. The width should not be more than twice the size of your website’s content div width. When I resize images I like to use FastStone Image Viewer. You could also do it online via TinyJPG.
- Disable plugins and/or themes (temporarily): don’t worry, you won’t be losing anything if you do this. Ideally, you shouldn’t do this on your live site, but on a clone.
Next, head over to Dashboard-> Plugins and bulk deactivate everything. If the problem disappears, you’ll have to play a plugin activate-deactivate game until you find it. On the same clone, you can deactivate the theme. If the theme is responsible…you’ll probably need to switch to a better one…sorry for the news.
- Check the “Uploads” folder permissions. Here’s where you need to get your hands a bit dirty. You will need to go to the “/wp-content/uploads” folder. This is where the files in the Media Library are actually stored. You can find it in the cPanel or via FTP.
In here you should change the permissions.
A permission with the numeric value of 644 for files, means that they are readable and writeable by the owner of the file. For directories, it is recommended to use 755.
Ideally, you should not mess with permissions, unless you are a really experienced WordPress user. The best way to solve this would be to ask for support from your hosting provider.
- Update PHP to 7.4 or greater – this is a WordPress official recommendation. This will give you some extra speed benefits as well. How to do the update depends on your hosting company, this means you should check their site, or talk to support. If you have access to cPanel, you can do this in the “Software” section:
- Increase PHP memory limit: when you share resources via a shared hosting server, from to time the server will not have enough memory to sustain the media upload process. This means you’ll need to raise the amount of memory PHP can use. This can be done in…cPanel, as you might have already guessed. You can do this from the previous Software – Select PHP version option. Now, in some cases, the field with the memory limit increase might be missing. This means you should contact your hosting provider.
- Disable mod_security: this is an open-source firewall that can also be disabled in the cPanel->Security. Make sure to toggle this on again when you’re done with the images.
Now, let’s say you are fixing this error once, twice….10 times. This means one thing: change your host.
Solving Other WordPress Media Errors
Now, let’s say your media is loaded. What can happen next?
- images not showing up in the Media Library
- Thumbnails (image preview/reduced versions of your media) not showing up in the WordPress Media Library. This means that you’ll have a hard time identifying images…
For these issues, two of the above solutions are a fit:
- Deactivate temporarily your plugins temporarily
- Change permissions to the “/wp-content/uploads” folder
And we’re done. Hope this helped you solve your own issue.