RetinaImage
Retina Image is a simple retina image tag that supports high resolution images using assets pipeline. It will find the suitable image for any resolution for you. Also, this gem does not override your original image_tag.
Usage
Add images as example_1x.png, example_2x.png, example_3x.png to your asset pipeline
then add below code to your view.
<%= retina_image_tag 'example.png' %>
Output
<img srcset="/example_1x.png 1x, /example_2x.png 2x, /example_3x.png 3x" alt="Example" src="/example_1x.png">
Add other options. For example
<%= retina_image_tag 'example.png', alt: 'Example Wow' %>
Output
<img srcset="/example_1x.png 1x, /example_2x.png 2x, /example_3x.png 3x" alt="Example Wow" src="/example_1x.png">
Disable retina image tag by adding include_srcsets: false
<%= retina_image_tag 'example.png', include_srcsets: false%>
Output
<img src="/example_1x.png" alt="Example" >
Installation
Add this line to your application's Gemfile:
gem 'retina_image'
And then execute:
$ bundle
Or install it yourself as:
$ gem install retina_image
Contributing
Create pull requests. Raise issues.
License
The gem is available as open source under the terms of the MIT License.