cloudinex v0.6.0 Cloudinex.Url View Source
A module that helps creating urls to your cloudinary image, which can optionally transform the image as well.
Link to this section Summary
Functions
Given a cloudinary public id string, this will generate an image url of where the image is hosted. You can also pass a map with options to apply transformations to the image, for more information see the documentation
Link to this section Functions
Given a cloudinary public id string, this will generate an image url of where the image is hosted. You can also pass a map with options to apply transformations to the image, for more information see the documentation.
Examples:
- A url to the image at its original dimensions and no transformations
iex> Cloudinex.Url.for("a_public_id")
"//res.cloudinary.com/my_cloud_name/image/upload/a_public_id"
- A url to the image with just a signature
iex> Cloudinex.Url.for("a_public_id", %{sign_url: true})
"//res.cloudinary.com/my_cloud_name/image/upload/s--MXxhpIBQ--/a_public_id"
- A url to the image adjusted to a specific width and height
iex> Cloudinex.Url.for("a_public_id", %{width: 400, height: 300})
"//res.cloudinary.com/my_cloud_name/image/upload/h_300,w_400/a_public_id"
- A url to the image using multiple transformation options and a signature
iex> Cloudinex.Url.for("a_public_id", %{crop: "fill", fetch_format: 'auto', flags: 'progressive', width: 300, height: 254, quality: "jpegmini", sign_url: true})
"//res.cloudinary.com/my_cloud_name/image/upload/s--jwB_Ds4w--/c_fill,f_auto,fl_progressive,h_254,q_jpegmini,w_300/a_public_id"
- A url to a specific version of the image
iex> Cloudinex.Url.for("a_public_id", %{version: 1471959066})
"//res.cloudinary.com/my_cloud_name/image/upload/v1471959066/a_public_id"
- A url to a specific version of the image adjusted to a specific width and height
iex> Cloudinex.Url.for("a_public_id", %{width: 400, height: 300, version: 1471959066})
"//res.cloudinary.com/my_cloud_name/image/upload/h_300,w_400/v1471959066/a_public_id"
- A url to the image with the file extension of the requested delivery format for the resource. The resource is delivered in the original uploaded format if the file extension is not included.
iex> Cloudinex.Url.for("a_public_id", %{format: "png"})
"//res.cloudinary.com/my_cloud_name/image/upload/a_public_id.png"
- A url to the resource type. If resource type not specified, “image” is the default
iex> Cloudinex.Url.for("a_public_id", %{resource_type: "video"})
"//res.cloudinary.com/my_cloud_name/video/upload/a_public_id"
- A url with an overlay
iex> Cloudinex.Url.for("a_public_id", [
...> %{border: "5px_solid_rgb:c22c33", radius: 5, crop: "fill", height: 246, width: 470, quality: 80},
...> %{overlay: "my_overlay", crop: "scale", gravity: "south_east", width: 128 ,x: 5, y: 15}
...> ])
"//res.cloudinary.com/my_cloud_name/image/upload/bo_5px_solid_rgb:c22c33,c_fill,h_246,q_80,r_5,w_470/c_scale,g_south_east,l_my_overlay,w_128,x_5,y_15/a_public_id"
- A url with a face
iex> Cloudinex.Url.for("a_public_id", %{width: 400, height: 300, face: true})
"//res.cloudinary.com/my_cloud_name/image/upload/g_face,h_300,w_400/a_public_id"