繁体   English   中英

通过UIImagepickerController从Camera拾取图像并将其保存到ios中的相册后,获取图像名称

[英]Get image name after picking image from Camera through UIImagepickerController and saving it to photos album in ios

我使用以下功能将图像保存到了相机胶卷中...

UIImageWriteToSavedPhotosAlbum(imurl!,nil,nil,nil)

如何使用功能获取保存图像的名称或URL?

您可以使用ALAssetsLibrary框架将映像保存在磁盘上。

请尝试以下方法-

ALAssetsLibrary().writeImageToSavedPhotosAlbum(editedImage.CGImage, orientation: ALAssetOrientation(rawValue: editedImage.imageOrientation.rawValue)!,
            completionBlock:{ (path:NSURL!, error:NSError!) -> Void in
                print("Image path - \(path)")
        })
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

          let imageUrl = info[UIImagePickerControllerReferenceURL] as! NSURL
          // here you got file path that you select from camera roll

          let image = info[UIImagePickerControllerOriginalImage] as! UIImage
         // here you got image that select from camera roll now just save it

         self.dismiss(animated: true, completion: nil)
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM