auto-rotated images come out wrong only on iphone and ipad

aligature

Joined: 2008-10-23
Posts: 5
Posted: Thu, 2010-08-12 13:49

I'm having an issue with how my rotated images appear when viewing from any iPhone or iPad. My EXIF based auto-rotate is enabled. When I view rotated pictures from my iDevices the generated thumbnail looks fine. Then when I view the basic resized and full images, the aspect ratio is correct, but the actual image is not rotated correctly and is stretched to fit the new dimensions. It seems like it's probably some interaction with the EXIF data, rotation, Mobile Safari being tricky and the img dimensions. Can anyone reproduce it on their side? Any workarounds?

Here is an example from my gallery:
https://aligature.com/gallery/v/2010/Utah/DSC01958.JPG.html


Gallery URL = https://aligature.com/gallery/main.php
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.10 apache2handler
Webserver = Apache/2.2.8 (CentOS)
Database = mysql 5.0.84, lock.system=flock
Toolkits = ArchiveUpload, LinkItemToolkit, ImageMagick, Gd, Exif, Getid3, Thumbnail, Ffmpeg, jpegtran
Acceleration = partial/900, partial/900
Operating system = Linux patterson.aligature.com 2.6.18-194.3.1.el5.centos.plusPAE #1 SMP Wed May 19 10:00:02 EDT 2010 i686
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7
Rows in GalleryAccessMap table = 88
Rows in GalleryAccessSubscriberMap table = 5259
Rows in GalleryUser table = 3
Rows in GalleryItem table = 5257
Rows in GalleryAlbumItem table = 237
Rows in GalleryCacheMap table = 30674

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Thu, 2010-08-12 16:49
Quote:
Any workarounds?

Apple probably thinks it's doing you a favor....

The only workaround I know of is to not have Gallery do the rotation. Rotate before hand, save it and upload.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
aligature

Joined: 2008-10-23
Posts: 5
Posted: Sat, 2010-08-14 14:56

Actually, I was able to get things resolved pretty easily. I'm not quite sure why it works, but I'm just happy that the pictures show up correctly now. For anyone else having the issue, here's what I did. I'm running on Linux, so your mileage may vary.

1) Go to my gallery data directory with a command line. Then move to the albums directory.
2) Make sure I have the exiv2 utility installed.
2) Find all jpg files and run this exiv2 command script which resets the exif orientation info.
find . -iname '*JPG' -print0 | xargs -0 -n1 sudo exiv2 -v -m ~/exivcmd -k modify
---- exifcmd file ----
set Exif.Image.Orientation 1
set Exif.Thumbnail.Orientation 1
---- exifcmd file ----
3) Use a browser to get to my gallery maintenance page. Something like www.mysite.com/gallery/lib/support/index.php. The password is in your config.php file.
4) Click on Cache Maintenance.
5) Select Cached HTML pages, Albums and Photo Data, and Thumbnails and Resizes.

Voila, all of my pictures show up correctly on my desktop, iPhone and iPad.