iPhone sends all photos as landscape to server
Making an app where we want to send a photo to a server along with some form data. For some reason any photo taken in portrait-mode gets sent rotated 90 degrees once on th开发者_C百科e server. Pretty sure we're missing something obvious here, but we're struggling to find any solution to this.
UIImage has an imageOrientation property. If you are using UIImage's then you need to take that into account when sending the image to the server, either by sending the orientation info to the server or else rotating the image (if the orientation isn't what the server expects).
Yes, portrait photos are only displayed as portrait because the phone is turned 90 degrees. All photos will come through as landscape because even though the software in the phone realizes the phone has been turned, the photo sensor doesn't. You will have to include a checkbox or something in the form to say "portrait" and pass that along in the form data and than use imaging software on the server to rotate the image to landscape if the box is checked.
精彩评论