上传到服务器后图像是否旋转?

时间:2016-11-30 06:55:54

标签: ios swift uiimageview uiimage

我有一个从相机拍摄的图像。我想上传它的服务器。我从相机下面的代码中获得了图像

 func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

    let originalImage = (info[UIImagePickerControllerOriginalImage] as? UIImage)!

    imageData = UIImageJPEGRepresentation(originalImage, 100) as NSData?

    if Constant.commonfunction.checkFileSize(fileData: imageData!)
    {
      let data = UploadData()
      data.fileName = "image.jpg"
      data.fileType = "Image"
      data.fileData = imageData as? Data
      data.mimeType = "image/jpg"
      arr_images.append(data)
      picker.dismiss(animated: true, completion: {

        self.collectionView.reloadData()

      })

    }
    else
    {
        Constant.commonfunction.showAlertView(title: "Warning", message: "Please upload a file of size less than 10 MB", vc: self)
    }



  }

请提出最佳解决方案。

1 个答案:

答案 0 :(得分:0)

我也有同样的问题但是在目标C.希望这可以帮助你。

检查目标C的这个文件

UIImage+Resize.h

UIImage+Resize.m