Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts

    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

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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).

  • #3
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts
    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

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •