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> 

Answers


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.


Need Your Help

Select distinct column along with some other columns in MySQL

mysql select distinct

I can't seem to find a suitable solution for the following (probably an age old) problem so hoping someone can shed some light. I need to return 1 distinct column along with other non distinct colu...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.