Sha256: 2df6648fb715a6066f2804536e75f3bb380023d16b0024d79ba27390b1d7dda2
Contents?: true
Size: 907 Bytes
Versions: 2
Compression:
Stored size: 907 Bytes
Contents
module RetinaImageTag module ViewHelpers def retina_image( pixel_ratio ) @retina_image_path = image_path(@file_name+"@#{pixel_ratio}x"+@file_ext) image_tag(@retina_image_path, @options) end def retina_image_tag(image, options = {}) @devicePixelRatio = cookies[:devicePixelRatio] @options = options @image = image # foo.jpg @file_path = image_path(@image) @file_ext = File.extname(@file_path) # .jpg, .png @file_name = File.basename(@image, @file_ext) # pic1, foo @file_dirname = File.dirname(@file_path) case @devicePixelRatio when '2' retina_image '2' when '1.5' retina_image '2' else image_tag(@file_path, @options) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
retina_image_tag-0.0.9 | lib/retina_image_tag/view_helpers.rb |
retina_image_tag-0.0.8 | lib/retina_image_tag/view_helpers.rb |