Expert Group of programming

How to Fix HTTP Error When Uploading Images- wordpress

Posted by : Heycode Tech | Posted in : wordpress, WordPress Functions | Dec 30,2016 | 0 comments

When we are going to upload the image FROM : MEDIA LIBRARY or any POSTS or PAGES : then sometime, we got the message :in red box with a message “HTTP Error” : , now today, I will show the code which is used to resolved this errors.


How to Resolved it

For resolving this issues, we will use the WP Module : Class Reference/WP Image Editor :It is an abstract class, so it can’t be called directly. It is used for implementations like WP_Image_Editor_GD and WP_Image_Editor_Imagick.

So you have to write the below code in theme file named – : functions.php :

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
  return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );

Now when you will add this code (Theme file named- functions.php – ) then I hope your problem have resolved.

Other Methods

Sometimes, we need to check of this module also .
1: Memory Limit :
If upload memory limit is less then it also give the error so for resolving it, you need to maximize the uploading limit.

Now you can do it in two ways.
1.1:Increase : PHP Memory Limit : via : php.ini :
1.2:Increase the memory limit by : wp-config.php : file .

//Add this code in file : wp-config.php
define('WP_MEMORY_LIMIT', '64M')

2: Through .htaccess

# Exclude the file upload and WP CRON scripts from authentication

<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$">
Order allow,deny
Allow from all
Deny from none

#By mod security

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

Use this code file : .htaccess :

I hope that from all the above procedure,your problem have been resolved.

From my recommendation, you need to follow the :Hooks : method which is discussed from top.


Author information - Heycode Tech

Every world can ask question and my website registered user give the suggestion.

See all posts by Author

Connect to author

Leave a Reply

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

About us

Heycodetech is a platform where you can ask any questions related to the programming like PHP,jQuery, MYSQL,HTML , CSS and more Here is the Expert group of programming.