Skip to content

socialpaymentsbv/cloudini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudini

TravisCI

Wrapper client library for Cloudinary API.

For the time being, only image upload and deletion are supported.

Installation

The package can be installed in a following steps:

  1. Add cloudini to your list of dependencies in mix.exs:
def deps do
  [{:cloudini, "~> 1.0"}]
end
  1. Ensure cloudini is started before your application:
def application do
   [applications: [:cloudini]]
end
  1. Configure cloudini in config/config.exs:
config :cloudini,
  name: "CLOUDINARYNAME",
  api_key: "APIKEY",
  api_secret: "APISECRET"

Usage

Basic Cloudindary API usage:

client = Cloudini.new

Cloudini.upload_image(client, "fixture/upload/test.gif", public_id: "image_id")
# {:ok, %{"public_id" => "image_id", ...}}

Cloudini.delete_image(client, "image_id")
# {:ok, %{"result" => "ok"}}

Helpers for building URLs:

  • fetch_url(client, "http://picture.from.internet.to.fetch.by.cloudinary.gif")
  • transform_url(client, "http://res.cloudinary.com/...", mode: "fill", width: 200)