Wrapper client library for Cloudinary API.
For the time being, only image upload and deletion are supported.
The package can be installed in a following steps:
- Add
cloudini
to your list of dependencies inmix.exs
:
def deps do
[{:cloudini, "~> 1.0"}]
end
- Ensure
cloudini
is started before your application:
def application do
[applications: [:cloudini]]
end
- Configure cloudini in
config/config.exs
:
config :cloudini,
name: "CLOUDINARYNAME",
api_key: "APIKEY",
api_secret: "APISECRET"
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)