Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-12-2012, 06:08 PM   PM User | #1
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
Image Taken From iPhones etc uploading Issue

Hi Guys,

Im in the middle of writing my own class which uploads, resizes and crops using jcrop for co-ordinates to crop and php for cropping, resizing and uploading.

Anyway the issue i have is when you upload an image that is portrait which is taken from an iPhone etc actually turns into landscape.

What can i do to change this?

Im not looking for code, im after logical solutions

Thanks
devinmaking is offline   Reply With Quote
Old 07-12-2012, 06:49 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,741
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Simply calculate the width to height ratio. If the width > height, it is in landscape, and you can issue a rotate on the image by 90/270 degrees (depends on how its rotated of course).
Fou-Lu is offline   Reply With Quote
Old 07-12-2012, 07:18 PM   PM User | #3
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
Quote:
Originally Posted by Fou-Lu View Post
Simply calculate the width to height ratio. If the width > height, it is in landscape, and you can issue a rotate on the image by 90/270 degrees (depends on how its rotated of course).
But this will not work will it as all iPhone, iPads etc the width is always greater than the height...

So how will it know if it needs it rotating.

I know how to rotate using php but how will it automatically know?

How does facebook do it?

Is there a code within the image which can check if its landscape or portrait?

for instance to get mime, width, height etc you can use getimagesize().

is there a way to get the exif information from an image

Last edited by devinmaking; 07-12-2012 at 07:24 PM..
devinmaking is offline   Reply With Quote
Old 07-12-2012, 07:29 PM   PM User | #4
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
Quote:
Originally Posted by Fou-Lu View Post
Simply calculate the width to height ratio. If the width > height, it is in landscape, and you can issue a rotate on the image by 90/270 degrees (depends on how its rotated of course).
Do you think this is something that will work.

http://www.php.net/manual/en/functio...data.php#76964
devinmaking is offline   Reply With Quote
Old 07-12-2012, 09:00 PM   PM User | #5
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,741
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Yep, according to the spec it looks like if orientation is provided its a part of the IFD0 blocks. Pull in an image with known orientation settings and dump it to the exif read to see if any of the results include the orientation flags.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:59 PM.


Advertisement
Log in to turn off these ads.