mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53848 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2615c4dc0c
commit
3deb9e9520
@ -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 = _wp_make_additional_mime_types( $additional_mime_types, $file, $image_meta, $attachment_id );
|
||||
$image_meta['image_meta']['orientation'] = $saved_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 );
|
||||
|
||||
// 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'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user