1

I've taken a photo using a DSLR in portrait orientation and resized it using PHP/ImageMagick. After uploading to Amazon S3, I noticed that if I were to view the image using Chrome and Internet Explorer, it will be rotated 90 degs into a landscape orientation, but if viewed using Firefox, its a portrait orientation!

Question: This is extremely puzzling to me, what is causing it to rotate and how can we fix the orientation?

Even on a webpage, a simple <img /> tag used to load the image causes different orientation! When viewed using Window 8's Window Photo Viewer, the photo is in portrait orientation.

The image can be viewed at https://s3.amazonaws.com/someRandomTest/1000108_medium.jpg


Update

identify -verbose 1000108_medium.jpg shows Orientation: Undefined

Canon DSLR photos have the unintended rotation. Nikon DSLR photos do not.

Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
  • have you tried to check the origination before resizing it with ImageMagick -- http://stackoverflow.com/questions/9371273/imagemagick-how-to-determine-orientation-of-jpeg-file -- also have you checked the original image to inspect the orientation EXIF tag in the image meta data.. other info on EXIF -- http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/ – Jonathan Marzullo Oct 18 '13 at 16:29

1 Answers1

3

Chrome and IE use the EXIF image orientation tag rotating the image, you can remove that tag and put it in its correct position.

$img = new Imagick($image);
$img->stripImage();
$img->writeImage($image);
$img->clear();
$img->destroy();
cmorrissey
  • 8,493
  • 2
  • 23
  • 27
  • `identify -verbose 1000108_medium.jpg` shows that `Orientation: Undefined`. Will this cause the browsers to rotate the image? – Nyxynyx Oct 18 '13 at 17:23