How to Fix HTTP Error When Uploading Images?

I put the following code into my functions.php file. It works!

add_filter( 'wp_image_editors', 'change_graphic_lib' );

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

When this helps it is because it changes the PHP code module used for processing the uploaded image for use with WordPress.

This processing includes moving the image into the media library database and generating the different size images (“thumbnail”, “medium”, “large”) that WordPress always wants available for themes to access.

It causes the “GD” module to be used, because it is first. In some server setups, the newer “Imagick” library isn’t playing well with others for certain image scenarios, such as large pixel dimensions, so forcing the “GD” library to be used is a fix.

Leave a Comment