cdoggg94 Posted April 15, 2013 Share Posted April 15, 2013 My question is pretty much what the title says. If an image is uploaded from a computer it works fine. When an image is uploaded from an iPad, it displays it upside down. Has anyone ever heard of this ? Or dealt with it before ? If so, any suggestions on what I should do about it ? Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/ Share on other sites More sharing options...
lemmin Posted April 15, 2013 Share Posted April 15, 2013 Are you sure this is ALL pictures from an iPad? My first guess is that, since an iPad doesn't really have a permanent orientation, the pictures themselves were actually taken upside-down. If they are ALL upside-down, you can flip anything coming from an iPad, but if it is just some, you would need some kind of orientation recognizing software to solve that problem. Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424931 Share on other sites More sharing options...
requinix Posted April 15, 2013 Share Posted April 15, 2013 (edited) IIRC Mac software may include orientation data in the picture: the actual image is upside-down but the metadata specifies that the image needs to be rotated. Problem is that software has to be aware of and able to read that metadata. exif_read_data may be able to tell you. Try it on a flipped image: what does it return? Edited April 15, 2013 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424944 Share on other sites More sharing options...
Jessica Posted April 15, 2013 Share Posted April 15, 2013 Maybe you're just holding it wrong. (Sorry, I couldn't resist) Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424971 Share on other sites More sharing options...
cdoggg94 Posted April 16, 2013 Author Share Posted April 16, 2013 Jessica, you are usually a lot more help than this haha The images we tried were taken in landscape. We joked that maybe they were taken upside down, but its obviously hard to tell on an iPad. requinix, I am going to try that out and see what happens. Thanks everyone. Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424975 Share on other sites More sharing options...
cdoggg94 Posted April 16, 2013 Author Share Posted April 16, 2013 We just took images from every position and it always comes out wrong. So, I tried this: <?php echo "resized_image.jpg:<br />\n"; $exif = exif_read_data('images/resized_image.jpg', 'IFD0'); echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n"; $exif = exif_read_data('images/resized_image.jpg', 0, true); echo "resized_image.jpg:<br />\n"; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { echo "$key.$name: $val<br />\n"; } } ?> ...and it spit this out : resized_image.jpg:No header data found.resized_image.jpg:FILE.FileName: resized_image.jpgFILE.FileDateTime: 1366072804FILE.FileSize: 11831FILE.FileType: 2FILE.MimeType: image/jpegFILE.SectionsFound: COMMENTCOMPUTED.html: width="272" height="350"COMPUTED.Height: 350COMPUTED.Width: 272COMPUTED.IsColor: 1COMMENT.0: CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 80 I am either missing the orientation metadata or don't know where it is, OR don't know how to display it. In the template I got the code from it printed this about the image they used: test1.jpg:No header data found.test2.jpg:FILE.FileName: test2.jpgFILE.FileDateTime: 1017666176FILE.FileSize: 1240FILE.FileType: 2FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENTCOMPUTED.html: width="1" height="1"COMPUTED.Height: 1COMPUTED.Width: 1COMPUTED.IsColor: 1COMPUTED.ByteOrderMotorola: 1COMPUTED.UserComment: Exif test image.COMPUTED.UserCommentEncoding: ASCIICOMPUTED.Copyright: Photo © M.Boerger, Edited by M.Boerger.COMPUTED.Copyright.Photographer: Photo © M.BoergerCOMPUTED.Copyright.Editor: Edited by M.Boerger.IFD0.Copyright: Photo © M.BoergerIFD0.UserComment: ASCIITHUMBNAIL.JPEGInterchangeFormat: 134THUMBNAIL.JPEGInterchangeFormatLength: 523COMMENT.0: Comment #1.COMMENT.1: Comment #2.COMMENT.2: Comment #3endTHUMBNAIL.JPEGInterchangeFormat: 134THUMBNAIL.Thumbnail.Height: 1THUMBNAIL.Thumbnail.Height: 1 I don't see an orientation type thing there either though. Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424981 Share on other sites More sharing options...
Jessica Posted April 16, 2013 Share Posted April 16, 2013 I don't think there is such a thing. Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424982 Share on other sites More sharing options...
Jessica Posted April 16, 2013 Share Posted April 16, 2013 When you take a photo with an iPad or iPhone in order for it to be upside down on the actual device, you have to trick the phone into thinking its right side up. You posted this in PHP coding - is the problem when you upload the photos through a script? Are they correct when you import them to your computer from the device? What tool do you use? Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424983 Share on other sites More sharing options...
cdoggg94 Posted April 16, 2013 Author Share Posted April 16, 2013 Ok... So I think it's the iPad... I just tried with my iPhone (a landscape image) and it worked fine... My boss just left for a little bit, but when he comes back I am going to see about him putting the images on his computer and seeing if they are right. Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424985 Share on other sites More sharing options...
cdoggg94 Posted April 16, 2013 Author Share Posted April 16, 2013 Are you talking about when you take a picture with a phone or iPad in say portrait, then view it in portrait and its sideways ? Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424986 Share on other sites More sharing options...
Jessica Posted April 16, 2013 Share Posted April 16, 2013 Me? I can get it to do that completely upside down but also 90 degrees Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424989 Share on other sites More sharing options...
cdoggg94 Posted April 16, 2013 Author Share Posted April 16, 2013 We got it to upload correctly. This is how he said he got it to work: "anything like crop or enhance. then you save it and it's all is good. anything you do to the image saves it and the orientation is set." Not that its a perfect solution by any means, but it's something in the right direction. I will be dealing with this more in the next week or so I'm sure... Thank you lemmin, requinix, and Jessica Your help is much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/276989-picture-uploads-from-ipad-uploading-upside-down/#findComment-1424993 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.