Skip to content

Commit d013b20

Browse files
committed
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
1 parent 55bdc30 commit d013b20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wp-includes/class-wp-image-editor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ public function maybe_exif_rotate() {
512512
switch ( $orientation ) {
513513
case 2:
514514
// Flip horizontally.
515-
$result = $this->flip( true, false );
515+
$result = $this->flip( false, true );
516516
break;
517517
case 3:
518518
// Rotate 180 degrees or flip horizontally and vertically.
@@ -521,14 +521,14 @@ public function maybe_exif_rotate() {
521521
break;
522522
case 4:
523523
// Flip vertically.
524-
$result = $this->flip( false, true );
524+
$result = $this->flip( true, false );
525525
break;
526526
case 5:
527527
// Rotate 90 degrees counter-clockwise and flip vertically.
528528
$result = $this->rotate( 90 );
529529

530530
if ( ! is_wp_error( $result ) ) {
531-
$result = $this->flip( false, true );
531+
$result = $this->flip( true, false );
532532
}
533533

534534
break;
@@ -541,7 +541,7 @@ public function maybe_exif_rotate() {
541541
$result = $this->rotate( 90 );
542542

543543
if ( ! is_wp_error( $result ) ) {
544-
$result = $this->flip( true, false );
544+
$result = $this->flip( false, true );
545545
}
546546

547547
break;

0 commit comments

Comments
 (0)