Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

clear_eyes

> 编程语言
Open source

Automatic Retina Image Handling for Rails 3.1+

156 stars0 likes1 views
WebsiteGitHub

About

Automatic Retina Image Handling for Rails 3.1+

Clear Eyes

This makes is super easy to handle Retina images in your Rails 3.1+ apps. It adds r_image_tag that can be used in place of the existing image_tag and it'll automatically serve up Retina images to devices that can handle the resolution and normal images otherwise.

How to Use it

In your Gemfile:

gem 'clear_eyes'

In your application.js:

//= require clear_eyes

Usage

= r_image_tag('[email protected]')

This assumes that [email protected] is sized properly for retina images. Remember, Retina images are double the pixel density of standard images.

Now that you have Retina-ready images and a way to serve them up in your views, what about non-retina machines?

There's a rake for that! You only need to create one image (the Retina one).

Running this: rake clear_eyes:convert will convert create non-retina images from the images in app/assets/images. It's even take care of the file names! Pretty cool right? So, [email protected] will automatically be copied, downsized and named my_awesome_image.jpg.

NOTE rmagick "~> 2.13.1" must be added to your Gemfile for this to work. It is not included by default in order to avoid adding rmagick to your production environment.

You can thank me later.

Contributing

Please contribute! The community is much smarter than me and your help would be appreciated!

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Issues· 1 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言