{"id":13508362,"url":"https://github.com/smeevil/cloudex","last_synced_at":"2026-02-18T21:02:11.957Z","repository":{"id":46180859,"uuid":"54640535","full_name":"smeevil/cloudex","owner":"smeevil","description":"An elixir library which helps with uploading image files or urls to cloudinary","archived":false,"fork":false,"pushed_at":"2024-07-26T07:24:01.000Z","size":2958,"stargazers_count":104,"open_issues_count":18,"forks_count":67,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-02-10T19:18:31.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smeevil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-24T12:34:09.000Z","updated_at":"2025-12-14T14:07:53.000Z","dependencies_parsed_at":"2024-11-01T08:30:26.695Z","dependency_job_id":"6c836319-9463-4b8e-ae23-b975a99e11e8","html_url":"https://github.com/smeevil/cloudex","commit_stats":{"total_commits":131,"total_committers":27,"mean_commits":4.851851851851852,"dds":"0.45038167938931295","last_synced_commit":"187edf2e00be7e26775bad72a4f9ae0f45aba168"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/smeevil/cloudex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeevil%2Fcloudex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeevil%2Fcloudex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeevil%2Fcloudex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeevil%2Fcloudex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smeevil","download_url":"https://codeload.github.com/smeevil/cloudex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeevil%2Fcloudex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29596125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T20:59:56.587Z","status":"ssl_error","status_checked_at":"2026-02-18T20:58:41.434Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:52.030Z","updated_at":"2026-02-18T21:02:11.919Z","avatar_url":"https://github.com/smeevil.png","language":"Elixir","funding_links":[],"categories":["Images"],"sub_categories":[],"readme":"Cloudex\n======\n[![](https://img.shields.io/hexpm/v/cloudex.svg)](https://hex.pm/packages/cloudex) ![](https://img.shields.io/hexpm/dt/cloudex.svg) ![](https://img.shields.io/hexpm/dw/cloudex.svg) ![](https://img.shields.io/coveralls/smeevil/cloudex.svg) [![](https://img.shields.io/github/issues/smeevil/cloudex.svg)](https://github.com/smeevil/cloudex/issues) [![](https://img.shields.io/github/issues-pr/smeevil/cloudex.svg)](https://github.com/smeevil/cloudex/pulls) ![](https://semaphoreci.com/api/v1/smeevil/cloudex/branches/master/shields_badge.svg)\n\nCloudex is an Elixir library that can upload image files or urls to Cloudinary.\nThere is also a [CLI tool](https://github.com/smeevil/cloudex_cli) available.\n\n## Getting started\n\n```elixir\ndefp deps do\n  [  {:cloudex, \"~\u003e 1.3.0\"},  ]\nend\n```\n\nIf you are using elixir 1.4, you can skip this step.\nThe Cloudex app must be started. This can be done by adding :cloudex to\nthe applications list in your mix.exs file. An example:\n\n```elixir\n  def application do\n    [applications: [:logger, :cloudex],\n    ]\n  end\n```\n\n## Settings\n\nCloudex requires the API credentials of your Cloudinary account.\nYou can define either as ENV settings using the keys :\n```CLOUDEX_API_KEY``` ```CLOUDEX_SECRET``` and  ```CLOUDEX_CLOUD_NAME```\n\nor in your config.exs using :\n\n```elixir\n  config :cloudex,\n    api_key: \"my-api-key\",\n    secret: \"my-secret\",\n    cloud_name: \"my-cloud-name\"\n```\n\n[Jason](http://github.com/michalmuskala/jason) is the default json library in Cloudex. You can configure Cloudex to use another library. For example:\n\n```elixir\nconfig :cloudex, :json_library, YourLibraryOfChoice\n```\n\n\n## Uploading\nYou can upload image files or urls pointing to an image as follows :\n\n### example\nFor uploading a url :\n```elixir\niex\u003e Cloudex.upload(\"http://example.org/test.jpg\")\n{:ok, %Cloudex.UploadedImage{...}}\n```\n\nFor uploading a file :\n```elixir\niex\u003e Cloudex.upload(\"test/assets/test.jpg\")\n{:ok, %Cloudex.UploadedImage{...}}\n```\nYou can also upload a list of files, urls, or mix by giving upload a list like :\n```elixir\niex\u003e Cloudex.upload([\"/non/existing/file.jpg\", \"http://example.org/test.jpg\"])\n[{:error, \"File /non/existing/file.jpg does not exist.\"}, {:ok, %Cloudex.UploadedImage{...}}]\n```\n\nAn example of the %Cloudex.UploadedImage{} Struct looks as follows:\n\n```elixir\n%Cloudex.UploadedImage{\n    bytes: 22659,\n    created_at: \"2015-11-27T10:02:23Z\",\n    etag: \"dbb5764565c1b77ff049d20fcfd1d41d\",\n    format: \"jpg\",\n    height: 167,\n    original_filename: \"test\",\n    public_id: \"i2nruesgu4om3w9mtk1z\",\n    resource_type: \"image\",\n    secure_url: \"https://d1vibqt9pdnk2f.cloudfront.net/image/upload/v1448618543/i2nruesgu4om3w9mtk1z.jpg\",\n    signature: \"77b447746476c82bb4921fdea62a9227c584974b\",\n    source: \"http://example.org/test.jpg\",\n    tags: [],\n    type: \"upload\",\n    url: \"http://images.cloudassets.mobi/image/upload/v1448618543/i2nruesgu4om3w9mtk1z.jpg\",\n    version: 1448618543,\n    width: 250\n}\n```\n\nYou can tag uploaded images with strings:\n\n```elixir\n# as array\nCloudex.upload(\"test/assets/test.jpg\", %{tags: [\"foo\", \"bar\"]})\n# as comma-separated string\nCloudex.upload(\"test/assets/test.jpg\", %{tags: \"foo,bar\"})\n\n# result\n{:ok, %Cloudex.UploadedImage{\n    bytes: 22659,\n    created_at: \"2015-11-27T10:02:23Z\",\n    etag: \"dbb5764565c1b77ff049d20fcfd1d41d\",\n    format: \"jpg\",\n    height: 167,\n    original_filename: \"test\",\n    public_id: \"i2nruesgu4om3w9mtk1z\",\n    resource_type: \"image\",\n    secure_url: \"https://d1vibqt9pdnk2f.cloudfront.net/image/upload/v1448618543/i2nruesgu4om3w9mtk1z.jpg\",\n    signature: \"77b447746476c82bb4921fdea62a9227c584974b\",\n    source: \"http://example.org/test.jpg\",\n    tags: [\"foo\", \"bar\"],\n    type: \"upload\",\n    url: \"http://images.cloudassets.mobi/image/upload/v1448618543/i2nruesgu4om3w9mtk1z.jpg\",\n    version: 1448618543,\n    width: 250\n}}\n```\n\nList of additional parameters you can use with `upload/2`:\nhttp://cloudinary.com/documentation/image_upload_api_reference#upload\n\n## Cloudinary URL generation\n\nThis package also provides an helper to generate urls from cloudinary given a public id of the image.\nAs a second argument you can pass in options to transform your image according via cloudinary.\n\nCurrent supported options are :\n```elixir\n  :aspect_ratio\n  :border\n  :color\n  :coulor\n  :crop\n  :default_image\n  :delay\n  :density\n  :dpr\n  :effect\n  :fetch_format\n  :flags\n  :gravity\n  :height\n  :opacity\n  :overlay\n  :quality\n  :radius\n  :transformation\n  :underlay\n  :width\n  :x\n  :y\n  :zoom\n```\n### Example\n```elixir\nCloudex.Url.for(\"a_public_id\")\n\"//res.cloudinary.com/my_cloud_name/image/upload/a_public_id\"\n```\n\n```elixir\nCloudex.Url.for(\"a_public_id\", %{width: 400, height: 300})\n\"//res.cloudinary.com/my_cloud_name/image/upload/h_300,w_400/a_public_id\"\n```\n\n```elixir\nCloudex.Url.for(\"a_public_id\", %{crop: \"fill\", fetch_format: 'auto', flags: 'progressive', width: 300, height: 254, quality: \"jpegmini\", sign_url: true})\n\"//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\"\n```\n\nYou can add multiple effects using Cloudex.Url.for/2, an example would be adding an overlay to your image, using:\n```elixir\nCloudex.Url.for(\"a_public_id\", [\n  %{border: \"5px_solid_rgb:c22c33\", radius: 5, crop: \"fill\", height: 246, width: 470, quality: 80},\n  %{overlay: \"my_overlay\", crop: \"scale\", gravity: \"south_east\", width: 128 ,x: 5, y: 15}\n])\n\"//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\"\n```\n## Deleting images\nYou can request deletion from cloudinary using ```Cloudex.delete/1``` function where the first argument should be the public id of the image you want to delete.\n\n### example:\n```elixir\niex\u003e Cloudex.delete(\"public-id-1\")\n{:ok, %Cloudex.DeletedImage{public_id: \"public-id-1\"}}\n\niex\u003e Cloudex.delete([\"public-id-1\", \"public-id-2\"])\n[\n  {:ok, %Cloudex.DeletedImage{public_id: \"public-id-1\"}},\n  {:ok, %Cloudex.DeletedImage{public_id: \"public-id-2\"}}\n]\n```\n\n\n\n## Phoenix helper\nIf you are using phoenix, you can create a small helper called for example cl_image_tag\nCreate a file containing the following :\n\n```elixir\ndefmodule MyApp.CloudexImageHelper do\n  import Phoenix.HTML.Tag\n\n  def cl_image_tag(public_id, options \\\\ []) do\n    transformation_options = %{}\n    if Keyword.has_key?(options, :transforms) do\n      transformation_options = Map.merge(%{}, options[:transforms])\n    end\n\n    image_tag_options = Keyword.delete(options, :transforms)\n\n    defaults = [\n      src: Cloudex.Url.for(public_id, transformation_options),\n      width: picture.width,\n      height: picture.height,\n      alt: \"image with name #{public_id}\"\n    ]\n\n    attributes = Keyword.merge(defaults, image_tag_options)\n\n    tag(:img, attributes)\n  end\nend\n```\n\nThen in your ```web.ex``` add the following line in the ```def view``` section:\n\n```elixir\nimport MyApp.CloudexImageHelper\n```\n\nYou should now be able to use the helper in your views as follows :\n\n```elixir\ncl_image_tag(public_id, class: \"thumbnail\", transforms: %{opacity: \"50\", quality: \"jpegmini\", sign_url: true})\n```\n\n## Documentation\n\nDocumentation can be found at docs/index.html or [online](http://smeevil.github.io/cloudex)\n\n## License\n\nThe Cloudex Elixir library is released under the DWTFYW license. See the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmeevil%2Fcloudex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmeevil%2Fcloudex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmeevil%2Fcloudex/lists"}