Upload: When an image was scaled because it is larger than the big image threshold, use the originally uploaded image's dimensions in wp_get_missing_image_subsizes(). Fixes an edge case/inconsistent behaviour when a registered image sub-size is also larger than the big image threshold.

Props desrosj, azaozz.
Merges [46677] to the 5.3 branch.
Fixes #48518.

git-svn-id: https://develop.svn.wordpress.org/branches/5.3@46680 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2019-11-08 22:55:34 +00:00
parent cdeeb8503a
commit d0e44e8187

View File

@ -90,8 +90,20 @@ function wp_get_missing_image_subsizes( $attachment_id ) {
return $registered_sizes; return $registered_sizes;
} }
$full_width = (int) $image_meta['width']; // Use the originally uploaded image dimensions as full_width and full_height.
$full_height = (int) $image_meta['height']; if ( ! empty( $image_meta['original_image'] ) ) {
$image_file = wp_get_original_image_path( $attachment_id );
$imagesize = @getimagesize( $image_file );
}
if ( ! empty( $imagesize ) ) {
$full_width = $imagesize[0];
$full_height = $imagesize[1];
} else {
$full_width = (int) $image_meta['width'];
$full_height = (int) $image_meta['height'];
}
$possible_sizes = array(); $possible_sizes = array();
// Skip registered sizes that are too large for the uploaded image. // Skip registered sizes that are too large for the uploaded image.