0

I am looking to perform image transformations using cloudinary on a web image url using the "fetch" type. I am looking to do something similar to the JAVA example for android here, but using Swift.

How can I achieve this in Swift?

Thanks!

Nadav Ofir
  • 778
  • 4
  • 6
Shivam Bhalla
  • 1,879
  • 5
  • 35
  • 63

1 Answers1

0

There are many ways to tackle this, for example you can use something like that:

let options:NSDictionary = [
    "transformation": CLTransformation(dictionaries: [["width":300,"height":300,"crop":"fill","gravity":"face","radius":"max","fetch_format":"auto",]]),
    "type": "fetch"
    ]
let url:String = Cloudinary!.url("http://upload.wikimedia.org/wikipedia/commons/0/0c/Scarlett_Johansson_Césars_2014.jpg", options:options1 as! [AnyHashable: Any])

The result url in this case will be: http://res.cloudinary.com/demo/image/fetch/c_fill,f_auto,g_face,h_300,r_max,w_300/http://upload.wikimedia.org/wikipedia/commons/0/0c/Scarlett_Johansson_C%C3%A9sars_2014.jpg

Nadav Ofir
  • 778
  • 4
  • 6