iOS wrong orientation when using front camera on U

2019-08-01 10:00发布

问题:

I'm using UIImagePickerController to snap an image and uploading it to server.

When taking a photo in the front camera, the height/width get reversed somewhere.

The image is displayed correctly later, but height and width are reversed (and I'm using them for the UIImageView autolayout constraint)

The thing is - that when looking at UIImagePickerControllerMediaMetadata of front and back camera images - the EXIF and the rest of the metadata is the same (resolution is smaller but the height/width ratio is the same)

Any ideas what is the difference?

回答1:

Apple images are always landscape left with EXIF and the orientation is specified in the EXIF.



回答2:

OK, so @zaph comment is correct, apparently back camera images are "reversed" as well - the upload code in the server (Codeigniter PHP) ignored the EXIF.

The problem surfaced only due to front camera low resolution...