hosting images

How to add your images to Rails and make Heroku host them!

First, upload your images to app/assets/images and push to heroku.
Heroku needs Rails to 'precompile' your images in order to serve them. Run heroku run rake assets:precompile at your command prompt. In your views, you will need to reference the public image path, and Rails fills this path in for you using two functions:
image_tag filename, height: height, width: width, class: class, alt: alt text

Subscribe to RSS - hosting images