diff --git src/wp-admin/includes/image.php src/wp-admin/includes/image.php
index 98689672b3..c2652792cb 100644
|
|
|
function wp_create_image_subsizes( $file, $attachment_id ) { |
| 341 | 341 | wp_update_attachment_metadata( $attachment_id, $image_meta ); |
| 342 | 342 | |
| 343 | 343 | if ( ! empty( $additional_mime_types ) ) { |
| 344 | | // Use the original file's exif_meta orientation information for secondary mime generation. |
| 345 | | $saved_orientation = $image_meta['image_meta']['orientation']; |
| | 344 | // Use the original file's exif_meta orientation and size information for secondary mime generation to ensure |
| | 345 | // sub-sized images are correctly scaled and rotated. |
| | 346 | |
| | 347 | // Save data. |
| | 348 | $saved_meta = array(); |
| | 349 | $saved_meta['orientation'] = $image_meta['image_meta']['orientation']; |
| | 350 | $saved_meta['width'] = $image_meta['width']; |
| | 351 | $saved_meta['height'] = $image_meta['height']; |
| | 352 | |
| | 353 | // Temporarily set the image meta to the original file's meta. |
| 346 | 354 | $image_meta['image_meta']['orientation'] = $exif_meta['orientation']; |
| 347 | | $image_meta = _wp_make_additional_mime_types( $additional_mime_types, $file, $image_meta, $attachment_id ); |
| 348 | | $image_meta['image_meta']['orientation'] = $saved_orientation; |
| | 355 | $image_meta['width'] = $imagesize[0]; |
| | 356 | $image_meta['height'] = $imagesize[1]; |
| | 357 | |
| | 358 | $image_meta = _wp_make_additional_mime_types( $additional_mime_types, $file, $image_meta, $attachment_id ); |
| | 359 | |
| | 360 | // Restore the saved meta data. |
| | 361 | $image_meta['image_meta']['orientation'] = $saved_meta['orientation']; |
| | 362 | $image_meta['width'] = $saved_meta['width']; |
| | 363 | $image_meta['height'] = $saved_meta['height']; |
| 349 | 364 | |
| 350 | 365 | } |
| 351 | 366 | |