cloudex v0.1.12 Cloudex.Url

A module that helps creating urls to your cloudinary image, which can optionally transform the image as well.

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

Functions

for(public_id, options \\ %{})

Specs

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 :

An url to the image at its original dimensions and no transformations

iex> Cloudex.Url.for("a_public_id")
"//res.cloudinary.com/my_cloud_name/image/upload/a_public_id"

An url to the image adjusted to a specific width and height

iex> Cloudex.Url.for("a_public_id", %{width: 400, height: 300})
"//res.cloudinary.com/my_cloud_name/image/upload/h_300,w_400/a_public_id"

An url to the image using multiple transformation options and a signature

iex> Cloudex.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"

An url to a specific version of the image

iex> Cloudex.Url.for("a_public_id", %{version: 1471959066})
"//res.cloudinary.com/my_cloud_name/image/upload/v1471959066/a_public_id"

An url to a specific version of the image adjusted to a specific width and height

iex> Cloudex.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"

An 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> Cloudex.Url.for("a_public_id", %{format: "png"})
"//res.cloudinary.com/my_cloud_name/image/upload/a_public_id.png"

An url to the resource type. If resource type not specified, “image” is the default

iex> Cloudex.Url.for("a_public_id", %{resource_type: "video"})
"//res.cloudinary.com/my_cloud_name/video/upload/a_public_id"