I don’t know why, but now, WordPress is adding a suffix “-scaled” at the end of each newly uploaded image.

enter image description here

And, instead of keeping the original image link, it changes it to the “-scaled” version:

enter image description here

I found the culprit in /wp-admin/includes/image.php which has this:

        if ( ! is_wp_error( $resized ) ) {
            // Append "-scaled" to the image file name. It will look like "my_image-scaled.jpg".
            // This doesn't affect the sub-sizes names as they are generated from the original image (for best quality).
            $saved = $editor->save( $editor->generate_filename( 'scaled' ) );

How to get rid of this behavior?

2 Answers
2

How to disable this behaviour?

Add this to your functions.php:

add_filter( 'big_image_size_threshold', '__return_false' );

How does it work?

When a new image is uploaded, WordPress will detect if it is a “big” image by checking if its height or width exceeds the big_image threshold. The default threshold value is 2560px, filterable with the new big_image_size_threshold filter.

If the image’s height or width is above this threshold, it will be scaled down, with the threshold being used for maximum height and max. width value. The scaled down image will be used as the largest available size.

In this case, the original image file is stored in the uploads directory and its name is stored in another array key in the image meta array: original_image. To be able to always get the path to an originally uploaded image a new function wp_get_original_image_path() was introduced.

Source: Introducing handling of big images in WordPress 5.3 by Justin Ahinon

Leave a Reply

Your email address will not be published. Required fields are marked *