WordPress.org

Ideas

Cure for the common upload HTTP Error

  1. wilcosky
    Member

    12345

    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.

    Posted: 4 months ago #
  2. Ipstenu (Mika Epstein)
    Lead Plugin Wrangler

    We don't default to GD because it's slower and makes worse compressions.

    HOWEVER. The core team is working on making Imagick work better, but a large part of the issue is that it's a PHP problem and not really a WordPress one.

    The tl;dr summary? PHP has trouble processing large images. Sometimes it fails to resize and when it does, you get the HTTP error

    Posted: 4 months ago #
  3. wilcosky
    Member

    12345

    This is interesting. Obviously it wouldn't work in older browsers. But, more and more, I think most people are using HTML5 compatible browsers.

    https://wordpress.org/plugins/canvas-image-resize/

    Posted: 1 month ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    1 Vote
  • Status

    Good idea! We're working on it