Sometimes images selected from photo album c UIImagePickerControllerare cropped differently than how the user wants to sow it. This happens in approx. 1 out of 50 image downloads.
When this happens, images are always cropped to part of the image from the upper left corner. Here is an example of an image with (1) showing in the red box what the user supposedly chooses to crop, and (2) which image ends on the server.

(1) , , , . . , , , , , .
, .
(, ):
class ImagePicker {
private let imagePicker = UIImagePickerController()
func showPicker() {
imagePicker.sourceType = .PhotoLibrary
imagePicker.mediaTypes = [kUTTypeImage as String]
imagePicker.allowsEditing = true
imagePicker.delegate = delegate
imagePicker.modalPresentationStyle = .OverFullScreen
parentViewController.presentViewController(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let image = info[UIImagePickerControllerEditedImage] as? UIImage {
uploadImage(image)
}
picker.dismissViewControllerAnimated(true, completion: nil)
}
func uploadImage(image: UIImage) {
let imageData = UIImageJPEGRepresentation(image, 0.75)!
let imageFile = PFFile(name: "image.png", data: imageData)
let imageObject = PFObject(className: "ImageClass")
imageObject(imageFile, forKey: "imageFile")
imageObject.saveInBackground()
}
}
- , ?
:
iPad, , .