Almost every WordPress user has experienced the frustrating HTTP Error when uploading an image. There are many pieces of advice out there about how to solve it. Add code to the .htaccess, contact your web host, increase memory, increase max allowed file size, etc.
Sometimes there's only one solution, that I've found, will solve the issue. That solution is to add the following code by Mike Schroder to your functions file (ideally child theme functions file).
This code makes WordPress default to the GD image editor. I'm not an expert, maybe it's not as good as the way WordPress normally uploads and edits images. But, I do know that without the following code, I will almost always get a HTTP Error when uploading a large image. However, after adding this code, the problem is gone. No matter how big of an image I upload (within reason). This isn't the first time this code has saved me. There must be something to it.
So, my idea is, why not set WordPress up this way by default? Or, at least have a setting one can click that automatically switches to this GD image editor.
The code I'm talking about:
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' );
If this is a poor solution, then there must be another way. Some way to fix/change the way WordPress uploads images and creates thumbnails. The current way is buggy and many people have the same or similar issues. Media uploads are extremely important for any CMS or blogging platform. It's time for all the WordPress gurus to put their heads together and solve this. A quick Google search will prove this is a big issue.