From d013b20c323c820e930351b89c93e8bcbccf8089 Mon Sep 17 00:00:00 2001 From: Anthony Burchell Date: Tue, 20 Sep 2022 16:57:15 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@54265 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-image-editor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/class-wp-image-editor.php b/src/wp-includes/class-wp-image-editor.php index 375a2dd223..e7070b1ca6 100644 --- a/src/wp-includes/class-wp-image-editor.php +++ b/src/wp-includes/class-wp-image-editor.php @@ -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;