apply_filters( ‘big_image_size_threshold’, int $threshold, array $imagesize, string $file, int $attachment_id )

Filters the “BIG image” threshold value.

Description

If the original image width or height is above the threshold, it will be scaled down. The threshold is used as max width and max height. The scaled down image will be used as the largest available size, including the _wp_attached_file post meta value.

Returning false from the filter callback will disable the scaling.

Parameters

$thresholdint
The threshold value in pixels. Default 2560.
$imagesizearray
Indexed array of the image width and height in pixels.
  • 0 int
    The image width.
  • 1 int
    The image height.
$filestring
Full path to the uploaded image file.
$attachment_idint
Attachment post ID.

Source

$threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id );

Changelog

VersionDescription
5.3.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Usage examples:

    // completely disable image size threshold
    add_filter( 'big_image_size_threshold', '__return_false' );
    
    // increase the image size threshold to 4000px
    function mynamespace_big_image_size_threshold( $threshold ) {
    	return 4000; // new threshold
    }
    add_filter('big_image_size_threshold', 'mynamespace_big_image_size_threshold', 999, 1);

You must log in before being able to contribute a note or feedback.