Fix HTTP Error while Uploading Image in WordPress Website

WordPress is the largest CMS used all around the world. As it is easy to create a website in WordPress and add several features into it through a large variety of plugins available. At the same time, it throws you lot of errors, frequently.

Users are fortunate, that though a large number of users, the community is quite huge and errors are always been solved.

One of the errors amongst them is HTTP error while uploading images in WordPress Website. This could be frustrating at times. As it looks like things are not working out without any reason. I got this error while writing this article WordPress vs Blogger Comparison.

check out how it looks like in the below image.

http error

There could be several reasons why you would be facing the HTTP error while uploading images. Sometime conflicts between the plugins may also be resulting in that error. Here, we will look at some possible ways to solve this issue, and not to appear again n again.

How To Fix HTTP Error while Uploading images in WordPress Website

Though all the ideas are going to simple to get rid of it. Let’s go with the most simple one.

Fix 1. By Changing the File Extension

Change the Image format .png to .jpg and similarly vice-versa and simply re-upload again to your WordPress website.

If this doesn’t work, let move to the second one.

Fix 2. Through Plugin

Fix HTTP error by using a plugin. Simply Install a plugin called Default to GD from Github

Click on the Clone or Download Button, and then click on Download ZIP to download the plugin.

If this doesn’t work, then you can make the plugin as well on your own. Below is the source code for the same.

<?php
/*
Plugin Name: Default to GD
Plugin URI: http://wordpress.org/extend/plugins/default-to-gd
Description: Sets GD as default WP_Image_Editor class.
Author: Mike Schroder
Version: 1.0
Author URI: http://www.getsource.net/
*/
function ms_image_editor_default_to_gd( $editors ) {
$gd_editor = ‘WP_Image_Editor_GD’;
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( ‘wp_image_editors’, ‘ms_image_editor_default_to_gd’ ); 

Copy this code, Go to your server root directory and find wp-content – Plugins.

Simply create a directory as “default to GD,” and then create a file into it as default-to-GD.php and add the above code into it.

That’s it, you are done, and won’t be receiving any HTTP image error going further.

If, this sounds complex, check the other ones

Fix 3. By Adding code in Functions.php

You can also add a snippet to your theme as well.

Navigate to your AppearanceEditor, and then find “functions.php” file and add the below code at the bottom.

add_filter( ‘wp_image_editors’, ‘change_graphic_lib’ );

function change_graphic_lib($array) {
return array( ‘WP_Image_Editor_GD’, ‘WP_Image_Editor_Imagick’ );
}

Fix 4. Increase PHP Memory

You can always contact your hosting provider to do the same to increase the PHP memory.

But, I would say, do it yourself by simply adding the code in the WPConfig.php file.

define(‘WP_MEMORY_LIMIT’, ‘128M’); 

This action will increase the WordPress PHP memory limit if restricted. You can try changing it to 256M as well to get the issue solved.

5. Via .hta access

You can also make it through the .hta access file by adding a small snippet.

Note: Always backup the .hta access file before making any edits. Just being on a safer side.

Add the below code at the top of the .hta access file

AddType x-mapp-php5 .php

Final Words on HTTP Image Error:

These WordPress tricks work great. After getting that error, I have tried all and fortunately, all are working. Get rid of that freaking error.

Do let me know which one you tried and worked for you? Share it around, if this helps. Thanks!

  • I tried each solution one at a time, and #4 seems to have fixed my problem. Thanks!

  • Vishwajeet Kumar says:

    Hello Navin,

    Being working on some of my clients website, I realize that in general HTTP error occurs due to some plugins which create conflicts with Media uploads. However sites with low memory limit can also create the HTTP error. Thanks for this great tutorial.

    Have a great day 🙂
    Vishwajeet

    • Hi Vishwajeet,

      Thanks for sharing your experience. Definitely, plugins conflicts are being the reason behind, many WordPress errors.

      Have great day ahead!

  • >
    Questioncage

    Subscribe To QuestionCage

    Glad to see your Visit at QuestionCage!

    One more step to connect ahead "Subscribe to Us" and get the updates to your inbox directly.

    You have Successfully Subscribed to QuestionCage!