...

View Full Version : Image Taken From iPhones etc uploading Issue



devinmaking
07-12-2012, 06:08 PM
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

Fou-Lu
07-12-2012, 06:49 PM
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).

devinmaking
07-12-2012, 07:18 PM
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

devinmaking
07-12-2012, 07:29 PM
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/function.exif-read-data.php#76964

Fou-Lu
07-12-2012, 09:00 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum