I’ve come across several WordPress websites in the past few weeks where images are being rotated automatically. In the WordPress page or post editor the orientation (portrait or landscape) of the photo is correct however when the page or post is published (or viewed in draft) then the image gets rotated.
This is a simple to resolve issue but first off let’s understand why this is occurring.
Why are images rotating incorrectly?
Quite simply, the rotating photo problem happens with photos taken with Apple iPad or iPhone devices: Most modern digital camera devices record various information in the image file. This is called Exif data and includes GPS coordinates (if available), camera make and model, exposure information and so on. iOS devices record the orientation Exif information in a way that other cameras don’t. This means that many services and software don’t understand the orientation of photos taken on iOS devices. Because data is available in regards to the Exif orientation of a particular photo, the external service or software will try to understand the orientation however often gets the orientation incorrect as the data is not what is expected.
There is absolutely no reason why Apple can’t fix their iOS apps to rotate the JPEG properly. Apple should fix their apps instead of pushing their problem out to the entire Web. Mozilla Bugzilla, 2011
So, in summary, this (almost) always is a problem when photos are taken with Apple devices.
How to stop iPhone images rotating in WordPress
There are two simple means of solving this problem with WordPress:
Remove portrait/landscape information prior to adding to WordPress
With this method we stripe out the Exif information from the photo before we add it to the WordPress Media Library. I like this method as it has SEO benefits attached (by making the image filesize smaller therefore reducing page load time):
- Download and install FileOptimizer.
- Run your image through FileOptimizer.
- Add your images to your WordPress page or post.
Use a plugin to solve the rotation issue
This is the easiest way to resolve the problem but doesn’t reduce the photo file-size per the means described above. The plugin we add automatically fixes the problem for us.
- Install and activate the iOS Images Fixer WordPress plugin.
- Add images to your pages and posts as you normally would.
Your images taken with an iPad or iPhone will now display in the correct orientation in your WordPress pages and posts.