AlchemyCMS Cloudinary Integration

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

  • Easily upload images to the cloud.
  • Automatically perform smart image resizing, cropping and conversion without installing any complex software.
  • Images are seamlessly delivered through a fast CDN, and much much more.



Add this line to your application's Gemfile:

gem 'alchemy_cloudinary', github: 'AlchemyCMS/alchemy_cloudinary'

And then execute:

$ bundle

Or install it yourself as:

$ gem install alchemy_cloudinary


To use the Cloudinary Ruby on Rails library, you have to configure at least:

  • cloud_name
  • api_key
  • api_secret

Setting the configuration parameters can be done by:

  • programmatically in each call to a Cloudinary method
  • globally using config/cloudinary.yml configuration file

Warning: In this case you must exclude it from version control system (git, etc). In .gitignore you can add config/cloudinary.yml

  • use a Rails initializer file.

You can place a file named cloudinary.rb in the config/initializers folder of your Rails project.

Here's some sample initializer code:

  # config/initializer/cloudinary.rb
  Cloudinary.config do |config|
    config.cloud_name = 'sample'
    config.api_key = '874837483274837'
    config.api_secret = 'a676b67565c6767a6767d6767f676fe1' = true
    config.cdn_subdomain = true
  • dynamically configure the cloud_name, api_key, and api_secret by defining the CLOUDINARY_URL environment variable.

The configuration URL is available in the Management Console's dashboard of your account. When using Cloudinary through a PaaS add-on (e.g., Heroku), this environment variable is automatically defined in your deployment environment.

Here's a sample value:

CLOUDINARY_URL=cloudinary://874837483274837:[email protected]

Note: If you use more than one configuration option, the order of precedence is: CLOUDINARY_URL -> cloud_name -> cloudinary.yml



The gem is available as open source under the terms of the MIT License.