Media: use original image size data for full size secondary mime generation.
Correct an issue where the secondary mime type full size image would not be properly resized (and `-scaled` added to the name) when the original upload is over the `big_image_size_threshold` dimensions. Props mukesh27. See #55443. Built from https://develop.svn.wordpress.org/trunk@53848 git-svn-id: http://core.svn.wordpress.org/trunk@53407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4b0450af4f
commit
66372143a1
|
@ -341,11 +341,26 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
|
|||
wp_update_attachment_metadata( $attachment_id, $image_meta );
|
||||
|
||||
if ( ! empty( $additional_mime_types ) ) {
|
||||
// Use the original file's exif_meta orientation information for secondary mime generation.
|
||||
$saved_orientation = $image_meta['image_meta']['orientation'];
|
||||
// Use the original file's exif_meta orientation and size information for secondary mime generation to ensure
|
||||
// sub-sized images are correctly scaled and rotated.
|
||||
|
||||
// Save data.
|
||||
$saved_meta = array();
|
||||
$saved_meta['orientation'] = $image_meta['image_meta']['orientation'];
|
||||
$saved_meta['width'] = $image_meta['width'];
|
||||
$saved_meta['height'] = $image_meta['height'];
|
||||
|
||||
// Temporarily set the image meta to the original file's meta.
|
||||
$image_meta['image_meta']['orientation'] = $exif_meta['orientation'];
|
||||
$image_meta['width'] = $imagesize[0];
|
||||
$image_meta['height'] = $imagesize[1];
|
||||
|
||||
$image_meta = _wp_make_additional_mime_types( $additional_mime_types, $file, $image_meta, $attachment_id );
|
||||
$image_meta['image_meta']['orientation'] = $saved_orientation;
|
||||
|
||||
// Restore the saved meta data.
|
||||
$image_meta['image_meta']['orientation'] = $saved_meta['orientation'];
|
||||
$image_meta['width'] = $saved_meta['width'];
|
||||
$image_meta['height'] = $saved_meta['height'];
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53847';
|
||||
$wp_version = '6.1-alpha-53848';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue