Make WordPress Core

Opened 2 years ago

Closed 21 months ago

Last modified 21 months ago

#54937 closed defect (bug) (fixed)

EXIF image orientation issue

Reported by: tbember's profile tbember Owned by: antpb's profile antpb
Milestone: 6.1 Priority: normal
Severity: normal Version: 5.3
Component: Media Keywords: has-patch commit add-to-field-guide
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Description:
Images with EXIF orientation flag can be displayed in wrong orientation.

Steps to reproduce:
Go to the WordPress Media Library screen and upload images 2, 4, 5, 7 (either portrait or landscape) from the repo below - the images should display in wrong orientation.

https://github.com/recurser/exif-orientation-examples

Cause:
On wp-includes/class-wp-image-editor.php, the function flip() is being called with swapped parameters.

I presume there was probably some confusion around the meaning of $horz and $vert params. Rather than flipping the image horizontally and vertically, respectively, they actually flip the image along the horizontal and vertical axis, respectively, which is the complete opposite behavior. This subject has already been discussed on: #23775.

Proposed solution
Apply the attached patch.

Attachments (2)

54937.diff (1.2 KB) - added by tbember 2 years ago.
rotations.jpg (985.9 KB) - added by adamsilverstein 21 months ago.

Download all attachments as: .zip

Change History (17)

@tbember
2 years ago

#1 @SergeyBiryukov
2 years ago

  • Description modified (diff)
  • Milestone changed from Awaiting Review to 6.0
  • Version changed from 5.9 to 5.3

Hi there, welcome to WordPress Trac! Thanks for the ticket and the patch.

The code in question was added in [46202] / #14459, changing the version accordingly.

Moving to 6.0 for investigation.

This ticket was mentioned in Slack in #core by mike. View the logs.


2 years ago

This ticket was mentioned in Slack in #core-media by mike. View the logs.


2 years ago

#4 @kirasong
2 years ago

This came up in a bug scrub for 6.0, and I brought it up for discussion / testing in #core-media.

#5 @costdev
2 years ago

  • Milestone changed from 6.0 to 6.1

The patch still applies cleanly against trunk. However, as it still needs testing and today is 6.0 RC1, I'm moving this ticket to the 6.1 milestone.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


23 months ago

#7 @joedolson
23 months ago

  • Owner set to joedolson
  • Status changed from new to accepted

#8 @joedolson
23 months ago

  • Owner changed from joedolson to antpb
  • Status changed from accepted to assigned

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


21 months ago

#11 @adamsilverstein
21 months ago

  • Keywords commit added; needs-testing removed

The fix looks good here, I verified this corrects the rotation for the test set images.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


21 months ago

This ticket was mentioned in PR #3295 on WordPress/wordpress-develop by antpb.


21 months ago
#13

Core Patch: https://core.trac.wordpress.org/ticket/54937

This PR is only for testing purposes.

#14 @antpb
21 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 54265:

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.

#15 @milana_cap
21 months ago

  • Keywords add-to-field-guide added
Note: See TracTickets for help on using tickets.