How to access uploaded authenticated image in iOS (Swift Language)?
Hi,
private static func upload(_ image: AnyObject,
completion: @escaping (Result<CloudinaryResponse>) -> Void ) {
let options = ["resource_type" : "image",
"type" : "authenticated"]
do {
let cloudinary = try CLCloudinary(url: Configuration.cloudinaryURL())
let uploader = CLUploader(cloudinary, delegate: nil) uploader?.upload(image, options: options, withCompletion: {
(successResult, errorResult, code, idContext) in
print("Success")
}, andProgress: {
(bytesWritten, totalBytesWritten, totalBytesExpectedToWrite, idContext) in
print("Progress")
})
}
catch {
print("catch error")
}
}
-
Best practice would be to save the public ID to your DB, as it is the main resource identifier used by Cloudinary APIs and SDKs.
For generating authenticated resource you should use the 'authenticated' type along with `sign_url` set to `true`. Here's a code snippet for generating such a URL:
https://gist.github.com/roeeba/b475c6038942b9204593dfb43b1d5b7a
Please sign in to leave a comment.
Comments
1 comment