WordPress 5.3 Improves Large Image Handling

WordPress 5.3 Beta 3 was released this week and RC 1 is right around the corner, expected October 15. Core contributors have been publishing developer notes on new features landing in this release. One exciting enhancement that hasn’t received much attention yet is WordPress’ updated handling of large images.

Many WordPress users don’t consider the size of the images they are uploading to their sites, and modern smartphones are capable of producing very high quality images at very large file sizes. WordPress 5.3 will automatically detect large images (with a default threshold of 2560px) and generate a “web-optimized maximum size.” The threshold is used as the max-height and max-width value to scale down the image for use as the largest available size. A new big_image_size_threshold filter is available for developers who want to change the threshold size or disable the new feature altogether.

WordPress will store the original image size so that it is still accessible and a new function is available for fetching its path: wp_get_original_image_path(). It is also used to generate all the image sub-sizes.

More than two million WordPress users rely on plugins like Imsanity, Smushit, and EWWW Image Optimizer to optimize images. They often include additional features for bulk resizing previously uploaded images. WordPress’ new large image handling should not interfere with image optimization plugins, because it doesn’t affect the default settings that they often hook into and use to perform additional optimizations. The new core enhancement may be suitable to replace these plugins for some users who only require the bare minimum optimization on upload.

12

12 responses to “WordPress 5.3 Improves Large Image Handling”

  1. So .. this “improvement” is only based on the dimensions of an image, not its actual size (eg. JPEG quality)?

    Then its no real help at all. If it was actually about FILE SIZE detection, now THAT would be an actual improvement, and we’d all be instantly happy campers 😉

    cu, w0lf.

      • The new feature is based on the dimensions of the uploaded image, not the file size, so videos and PDFs are unaffected.

        Of course, if someone DID need to be more granular for other image types, it’s filterable (big_image_size_threshold), so the feature is infinitely configurable.

        Naturally, reducing the dimensions of an image also tends to reduce the filesize (sometimes drastically), which is a big improvement, regardless of what the wolf thinks 😉

    • This has more to do with the fact that the img srcset in WordPress feature was limited to a max image size of 1600px, so for Retina and hi resolution screens, often times the browser would automatically pull the unoptimized Original image if it needed something with higher resolution. And since most themes don’t create anything larger than the “Large” size which is 1024 (I think), huge Original images were loaded instead.

      Implementing this fix means that there are additional thumbnails at larger sizes that can be pulled by the browser, and NOT include the Original.

      Believe me, as a photographer, and a developer that works primarily with photographers, this is a feature I realized was necessary shortly after 4.4 came out. If you look in TRAC, I was raising this concern 2+ years ago.

      This is a much needed fix, and I appreciate that Morten, and the Media team are getting this incorporated.

    • Image compression is subjective and varies image to image. A photographer might want high quality (large file size) images, while another web dev might want the smallest filesize possible and not care about jpg artifacts. This is best left to the plugins.

      Max image size dimensions though is important as more and more “casual” webmasters use smartphones and upload photos directly without editing.

  2. While this has nothing to do with size….how about an option to limit the # of images/sizes that are created? I’ve run into plugins and or themes that create their own sizes, and a lot of them don’t show up in the media library area. Then every time an image is uploaded, 10 different sizes are created and in many cases a set of duplicates of the same size.

    • So far, my personal “fix”, or more like workaround, for this issue, has been to use one of the few available plugins that generate the resp. image sizes “on the fly”, ie. on-demand, when the image is actually called. The obvious disadvantage of that method of corpse is: The user will not instantly get the image shown, it has to be processed first.

      Maybe a mix of both would be more efficent – ie. generate only selected image sizes, eg. thumbnail / medium for previews, and then, when the on-demand call comes, the plugin uses this already existing thumbnail or medium image as a placeholder, until it is done processing the actually requested image size. Something kind of an adaptive image site aproach – although IDK how well this is going to work together with the picture element or the srcset attribute.

      cu, w0lf.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.