Skip to content

Instantly share code, notes, and snippets.

@superacidjax
Created July 16, 2012 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save superacidjax/3122895 to your computer and use it in GitHub Desktop.
Save superacidjax/3122895 to your computer and use it in GitHub Desktop.
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