Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 22 months ago

#33051 closed defect (bug) (duplicate)

Pictures rotated 90 degrees left on upload

Reported by: rdlynch's profile rdlynch Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Media Keywords: needs-patch
Focuses: Cc:

Description

When a user upoads a photo from an iPhone 5s (not sure about iPhone 6) in portrait mode the image is rotated 90 degrees left, and the user must login to WP admin to edit the image and rotate it 90 degrees right for proper orientation. This issue is detailed in this support forum post a year ago. Somehow WP needs to detect the meta data from the image and not rotate the image.

Attachments (2)

33051.diff (2.4 KB) - added by wpdavis 9 years ago.
33051.2.diff (2.4 KB) - added by wpdavis 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 @johnbillion
9 years ago

  • Keywords needs-testing added

Thank you for the report, rdlynch, and welcome to WordPress Trac.

Can we narrow down where the problem lies? I'd imagine that if this was widespread, we'd see many more reports of it. I suspect that this is either to do with the image processing library on the server, or the image's meta data is being stripped at some point during the steps described in the forum post linked above.

  • Can you find out if your server has the gmagick or imagick extension(s) installed? You can do this with the WP Extension Check script.
  • Does this happen every time or does it depend on the rotation lock on the phone?
  • Does it occur when directly uploading a file to WordPress?

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


9 years ago

#3 @ocean90
9 years ago

I'm pretty sure that this is an issue with the Exif orientation tag (http://sylvana.net/jpegcrop/exif_orientation.html) which iOS and OS X are using to rotate the image.

#4 @swissspidy
9 years ago

I can confirm this (iPhone 5s, iOS 9). No difference with screen lock on/off.

Sounds like an easy to fix. The Image Rotation Repair plugin doesn't exist without a reason.

There are some great articles about EXIF orientation on the web, like http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/ for instance.

I'll see if I can move that plugin into a patch.

#5 @wpdavis
9 years ago

  • Keywords needs-patch added; needs-testing removed

Hey, just ran into this! Some browsers will respect the orientation field in the EXIF data, others will not. So the fun surprise is that the image is oriented correctly in some browsers and not in others! Patch forthcoming.

@wpdavis
9 years ago

@wpdavis
9 years ago

#6 @wpdavis
9 years ago

OK, first pass at a patch added, but something weird is going on. It seems the issue is when an image gets rotated but the orientation field in the EXIF data doesn't get changed. I'm not actually sure how to identify this, but if somebody has an idea I'm all ears.

Here are examples of pretty much the same file. test1, if uploaded with the patch applied, will appear correctly. test2, if uploaded with the patch applied, will actually be over-rotated.

http://trunk.wpdavis.com/test1.jpg => Exif: http://trunk.wpdavis.com/test1.php
http://trunk.wpdavis.com/test2.jpg => Exif: http://trunk.wpdavis.com/test2.php

Another concern: rotating the image on upload destroys the rest of the Exif data, so things like caption, copyright, camera info etc. aren't preserved (at least using the GD library), and they obviously need to be.

Version 0, edited 9 years ago by wpdavis (next)

#7 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #14459 and #28676.

@wpdavis, could you please add your patch to #14459?

#8 @ayayay
9 years ago

  • Version 4.2.2 deleted

I think it does not work in Wordpress 4.4.2, does it? When I try to upload a iPhone photo, the scaled versions are still rotated.

#9 @ayayay
9 years ago

  • Version set to 4.4.2

This ticket was mentioned in Slack in #core-images by joemcgill. View the logs.


9 years ago

This ticket was mentioned in Slack in #core-images by joemcgill. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.