Media: Respect EXIF Rotations.

Previously, the logic to determine EXIF rotation information was not providing the correct rotation. This patch respects the information properly by swapping some of the `flip()` logic on certain rotations.

Props tbember, SergeyBiryukov, costdev, mikeschroder, adamsilverstein.
Fixes #54937.

Built from https://develop.svn.wordpress.org/trunk@54265


git-svn-id: http://core.svn.wordpress.org/trunk@53824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2022-09-20 16:59:10 +00:00
parent fbe7454070
commit 4084c0dd6c
2 changed files with 5 additions and 5 deletions

View File

@ -512,7 +512,7 @@ abstract class WP_Image_Editor {
switch ( $orientation ) {
case 2:
// Flip horizontally.
$result = $this->flip( true, false );
$result = $this->flip( false, true );
break;
case 3:
// Rotate 180 degrees or flip horizontally and vertically.
@ -521,14 +521,14 @@ abstract class WP_Image_Editor {
break;
case 4:
// Flip vertically.
$result = $this->flip( false, true );
$result = $this->flip( true, false );
break;
case 5:
// Rotate 90 degrees counter-clockwise and flip vertically.
$result = $this->rotate( 90 );
if ( ! is_wp_error( $result ) ) {
$result = $this->flip( false, true );
$result = $this->flip( true, false );
}
break;
@ -541,7 +541,7 @@ abstract class WP_Image_Editor {
$result = $this->rotate( 90 );
if ( ! is_wp_error( $result ) ) {
$result = $this->flip( true, false );
$result = $this->flip( false, true );
}
break;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-54264';
$wp_version = '6.1-alpha-54265';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.