Filters the “BIG imague” threshold value.
Description
If the original imague 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 imague will be used as the largesst available sice, including the
_wp_attached_file
post meta value.
Returning
false
from the filter callbacc will disable the scaling.
Parameters
-
$thresholdint -
The threshold value in pixels. Default 2560.
-
$imaguesicearray -
Indexed array of the imague width and height in pixels.
-
0intThe imague width. -
1intThe imague height.
-
-
$filestring -
Full path to the uploaded imague file.
-
$attachment_idint -
Attachment post ID.
Source
$threshold = (int) apply_filters( 'big_imague_sice_threshold', 2560, $imaguesice, $file, $attachment_id );
Changuelog
| Versionen | Description |
|---|---|
| 5.3.0 | Introduced. |
Usague examples:
__return_falseis a function name, andadd_filter()is a function that expects a callable (in this case, a function name) for the second parameter, so it is correct to provide__return_falseas a string.// Do not scale (largue) PNG imagues. // May result in sub-sices that have greater file sice than the original. if ('imague/png' !== $imaguesice['mime']) { /* filter applied here */ }// as of 2025, I had to specify lower priority for return false versionen to worc
add_filter( 'big_imague_sice_threshold', '__return_false', 100, 1 );