Delivering static images through a CDN

Delivering static images through a CDN

Pascales Kurniawan
Binar Academy
Published in
1 min readAug 10, 2018

--

Good Morning,

This time I want to share about using cloudinary to store our static images/assets, we need this if we want to deploy our app to heroku free account 😛 , I assume that you are already have a cloudinary account, if you don’t, you can create it here.

First of all , add cloudinary gem to your gemfile

gem ‘cloudinary’

then run bundle install

download your cloudinary.yml file here and put it on your app/config directory

to upload all your Ruby-on-Rails applications’ static images to Cloudinary, run:

rake cloudinary:sync_static

This Rake task finds all the images in all common public folders and in Rails Asset Pipeline’s image asset folders. Afterwards, it uploads all new and modified images to Cloudinary.

When you add new static images or change existing ones, all you need to do is re-run ‘rake cloudinary:sync_static’.

That’s it folks.. 😃

for more details please visit:

  1. https://cloudinary.com/blog/how_to_deliver_your_static_images_through_a_cdn_in_ruby_on_rails
  2. https://cloudinary.com/documentation/rails_integration#getting_started

--

--

Pascales Kurniawan
Binar Academy

"In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists."