I’m going to make this short because it’s 2:00 in the morning and I’m exhausted, but I wanted to share tonight’s project with you. I wrote a simple utility to “correct” the orientation of photos taken with iOS cameras. iOS handles camera orientation using EXIF data attached to the file. While this is a core part of how iOS works, other systems aren’t always set up to work with it, which can result in erroneously-rotated photos in places like this blog.
Even though this is a widely known issue, there are (strangely) no utilities on the App Store to address this. I wanted an easier solution, so I rolled my own.
A little PHP script that takes a file upload, passes it to
convert, deletes the original, and serves the new one to the client in the original format with a little bit of quality loss. iOS photos are uploaded in JPEG format, so this script outputs JPEG by default. An override is provided which will serve a TIFF instead, which should mean a somewhat better quality file.
I went ahead and put together a Github project with a little bit of documentation if anyone wants to poke around with it. I’ve got mine hosted on SDF. Any web server with PHP and ImageMagick should work fine.