Uploading images via iPhone with wrong orientation
We have set up a user submission on one of our websites. We wanted users to be able to upload images from their phones. After moderation they are approved and displayed in a masonry wall sounds pretty easy right?
Users submit their images through the Joomla component Zoo, everything worked fine while we were testing with a desktop computer. Once we started testing with an Iphone any images that were taken in a portrait format were rotated either 90 or 180 degrees. After digging around i found that the Iphone saves the orientation of the photo.
The Zoo component does a great job of resizing and saving out cached images, but it doesn't read the images orientation. So after images were cached they were almost all rotated.
To fix this i created a new image element, that uses a fair bit of the code from /administrator/components/com_zoo/helpers/imagethumbnail.php and /administrator/components/com_zoo/helpers/zoo.php files but it checks the images orientation and rotates it (if required) i found this script written by Neil Young That outlined the problem i was having perfectly. I just added the imageFlip() function into my newly created image element and bingo she was working.
You can download the imagerotate element for zoo down below. Just unzip it and upload it to your /media/zoo/applications/[ZOOAPPLICATIONTYPE]/elements folder. Then assign your new element in the application configuration. (guide here)