picture orientation from phone
We're using a file upload button for a user to upload a photo. This functionality never used to work on an iphone, not 100% sure about Andriod, but this was originally just a desktop site.
Over time, we've noticed that Andriod and the more recent updates for the iphone allow the user to not only select a photo from their camera roll, but it also gives them the option to take a picture, then "Use" or "Discard/Try Again".
This is all pretty cool, because we've done nothing on our end, but the phone is starting to work better.
However, 1 major issue is that 3 out of 4 times, the pictures are oriented wrong. All vertical pictures come in vertical, turned 90 degrees. Half the time, the horitzonal pic comes in upside down.
Is there any way to grab the orientation of the picture somehow when it's coming from the phone? Keep in mind, we're really just php, mysql, js currently.
Here's a sample of the code:
<form method="post" action="/page.php?id=12345" enctype="multipart/form-data"> <div> Add Photo: <input type="file" name="add_file_1" size="50" title="Add a Photo" /> <input type="submit" name="submit" value="Upload"/> </div> </form>
If the picture is vertical, the height should be greater than the width. You could add a check via PHP and label the picture in your database as either horizontal or vertical.
Edit: Here's a function you can use http://www.php.net/manual/en/function.getimagesize.php.