HTTP error:

One of the basic errors occurs while uploading a media in WordPress. There are so many reasons that could lead to an HTTP Image Upload error. Also, the multiple solutions available to solve it depending on its causes. Here we will show you some methods to resolve the error.

Increase WordPress memory limit:

Lack of memory is the cause for this error and this is the most common cause of the error. To resolve this error, you need to increase the memory limit of PHP on the server. Increasing the memory limit is a simple process. You just need to add the following code in the wp-config.php file.

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

The above-mentioned code will help you to increase the memory limit up to 256MB of your PHP. This memory limit will be enough to solve memory related issues.

Change image editor library:

There are two library modules are used in WordPress to handle the images. GD library and Imagick are the libraries used in WordPress. Either one will be used by WordPress depending upon the availability. Most of the HTTP errors have occurred when the user uses the Imagick library because it runs into memory issues frequently. To solve this error, make GD library as your default image editor. That can be done by simply adding the following codes into WordPress theme’s function.php file or a plugin called the site-specific plugin.

           function wpb_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’, ‘wpb_image_editor_default_to_gd’ );

This code will help you to fix the error. If the error persists, try other methods to solve.

Using .htaccess:

In this method, just add the following code into your .htaccess file that will limit Imagick to use a single thread to image process.
              SetEnv MAGICK_THREAD_LIMIT 1
It allows you to control server resources used by Imagick. In many servers, Multiple threads are used for faster image processing. This will leads to HTTP error.

These are the methods used for resolving the issue. We hope that these methods are helpful to solve the error.

Categorized in:

Tagged in:

,