Created
July 16, 2012 14:04
-
-
Save superacidjax/3122895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ClearEyes | |
module ViewHelpers | |
attr_accessor :image, :options | |
def r_image( pixel_ratio ) | |
insert_on = -File.extname(@image).size-1 | |
image_tag(@image.insert(insert_on, "@#{pixel_ratio}x"), @options) | |
end | |
def r_image_tag(image, options = {}) | |
@devicePixelRatio = cookies[:devicePixelRatio] | |
@options = options | |
@image = image | |
case @devicePixelRatio | |
when '2' | |
r_image 2 | |
when '1.5' | |
r_image 2 | |
else | |
image_tag(@image, @options) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment