WordPress

WordPress 5.3 will introduce handling of big images

Iakovos Frountas

Iakovos Frountas

In this article

The handling of big images has been in controversy for a long time among users and developers of WordPress. This happens because there are two types of images that are uploaded: Images that have been edited or created in an image editing application. Photos that are uploaded either directly from the camera or haven’t been edited. In the ... Read more

The handling of big images has been in controversy for a long time among users and developers of WordPress. This happens because there are two types of images that are uploaded:

  • Images that have been edited or created in an image editing application.
  • Photos that are uploaded either directly from the camera or haven’t been edited.

[toc]

In the first scenario, the images may have been already optimized for usage on the web, but in the second scenario, we often see big images (much bigger) than needed and are not ready for web use. Imagine a photo taken from a smartphone. Its average file size would be easily over 5MB. Imagine what is happening with photos taken from DSLR cameras.

WordPress handling of big images

Here comes WordPress 5.3 that introduces a new way to manage large images by detecting them and generating a “web-optimized maximum size” of them.

How it works

Every time we upload a new image, WordPress will detect if this image is a big one by checking its dimensions. If image dimensions are bigger than big_image_size threshold it will be scaled down, ti the threshold being used as max-height and max-width value. The new scaled-down image will be used as the largest available size.

Now the original image file is stored in the uploads directory and its name will be pushed in another array key. The image meta array: original_image. Also, a new function will be able to get the path to the original image.

wp_get_original_image_path()

Note that the default big_image threshold value is 2560px both for width and height.

Ability to disable the handling of big images

The scaling is controlled by the big_image_size_threshold action. We can disable the filter callback by making it return false.

apply_filters( 'big_image_size_threshold', false );
Iakovos Frountas

Iakovos Frountas

Since 2008 I have helped businesses like yours increase their online presence through powerful websites that help you easily, effectively, and affordably grow your business.

2 thoughts on “WordPress 5.3 will introduce handling of big images”

  1. apply_filters( ‘big_image_size_threshold’, false );

    does not work. no effect

    Reply

Leave a Comment

Grab a cookie!

This site is using cookies in order to provide you the best possible user experience. You can either totally accept or reject our cookies and of course you can anytime edit your preferences from the settings menu.

Accept all Reject all Settings