Z.Photos (Portico/Z v0.1.0)

Context for tasks related to Photos.

See the ID Photo Process guide for more details.

Link to this section Summary

Functions

Get photo info from the database

Convert a Cloudinary resource to EXPLO's preferred photo ID transformation.

Upload a photo file to the database

Link to this section Functions

Get photo info from the database

Link to this function

transformation_url(resource_id, type)

Specs

transformation_url(String.t(), String.t()) :: String.t()

Convert a Cloudinary resource to EXPLO's preferred photo ID transformation.

Possible transformation options are:

  • face_center - Center on the face, the default
  • rotate_left - 90 degree counterclockwise rotation
  • rotate_right - 90-degree clockwise rotation
  • v_flip - Vertical flip
  • zoom_out - Zoom out a bit
  • zoom_in - Zoom in a bit

Returns a URL referencing a PNG image.

Examples

iex> Z.Photos.transformation_url("sample", "face_center")
"https://res.cloudinary.com/explo/image/upload/c_thumb,e_improve,g_face:center,h_300,q_auto:good,r_max,w_300,z_0.8/sample.png"

iex> Z.Photos.transformation_url("sample", "zoom_out")
"https://res.cloudinary.com/explo/image/upload/c_thumb,e_improve,g_face,h_300,q_auto:good,r_max,w_300,z_0.6/sample.png"

iex> Z.Photos.transformation_url("sample", "rotate_left")
"https://res.cloudinary.com/explo/image/upload/a_-90,c_thumb,e_improve,g_face,h_300,q_auto:good,r_max,w_300,z_0.8/sample.png"

iex> Z.Photos.transformation_url("sample", "none")
"https://res.cloudinary.com/explo/image/upload/c_thumb,e_improve,g_face,h_300,q_auto:good,r_max,w_300,z_0.8/sample.png"
Link to this function

upload(file_path, options \\ %{})

Upload a photo file to the database

For details about options, see Library.Cloudinary.upload_file/2