Image is rotated when viewed on mobile phone browser

When developing a mobile app, I noticed that one person’s profile picture was showing up rotated sideways. When I visited this on my computer browser, it appeared fine, but when trying with an iPhone it was always to the side!

At first I thought this was a coding problem, but I realized that if I access the image directly through the url it does the same thing! Turns out that some cameras store orientation data with the image. Most desktop browsers don’t care about this, but for some reason mobile browsers do so they read that information and rotate the image the way it was taken.

An easy solution is to remove the EXIF data associated with that image. I did a quick google search and found sites that would strip exif data of any image and allow you to resave it. Doing that fixed it!

Hope that helps!


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *