diff --git src/wp-admin/includes/image.php src/wp-admin/includes/image.php
index b3b68560b4..c32dcec49c 100644
|
|
function wp_create_image_subsizes( $file, $attachment_id ) { |
249 | 249 | // Do not scale (large) PNG images. May result in sub-sizes that have greater file size than the original. See #48736. |
250 | 250 | if ( 'image/png' !== $imagesize['mime'] ) { |
251 | 251 | |
| 252 | $threshold = 2560; |
| 253 | |
| 254 | // If there are registered image sizes with a value greater than the default threshold, |
| 255 | // use that value instead of the default. See https://core.trac.wordpress.org/ticket/48489. |
| 256 | foreach ( wp_get_registered_image_subsizes() as $subsize ) { |
| 257 | if ( $subsize['width'] > $threshold ) { |
| 258 | $threshold = $subsize['width']; |
| 259 | } |
| 260 | if ( $subsize['height'] > $threshold ) { |
| 261 | $threshold = $subsize['height']; |
| 262 | } |
| 263 | } |
| 264 | |
252 | 265 | /** |
253 | 266 | * Filters the "BIG image" threshold value. |
254 | 267 | * |
… |
… |
function wp_create_image_subsizes( $file, $attachment_id ) { |
260 | 273 | * |
261 | 274 | * @since 5.3.0 |
262 | 275 | * |
263 | | * @param int $threshold The threshold value in pixels. Default 2560. |
| 276 | * @param int $threshold The threshold value in pixels. Default 2560 or the maximum registered image size. |
264 | 277 | * @param array $imagesize { |
265 | 278 | * Indexed array of the image width and height in pixels. |
266 | 279 | * |
… |
… |
function wp_create_image_subsizes( $file, $attachment_id ) { |
270 | 283 | * @param string $file Full path to the uploaded image file. |
271 | 284 | * @param int $attachment_id Attachment post ID. |
272 | 285 | */ |
273 | | $threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id ); |
| 286 | $threshold = (int) apply_filters( 'big_image_size_threshold', $threshold, $imagesize, $file, $attachment_id ); |
274 | 287 | |
275 | 288 | // If the original image's dimensions are over the threshold, |
276 | 289 | // scale the image and use it as the "full" size. |