retina_image_tag 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -29,9 +29,11 @@ and a @2x Retina Images: foo@2x.jpg (800x800px)
29
29
 
30
30
  and use it like normal
31
31
 
32
- <%= retina_image_tag 'foo.jpg' %>
32
+ <%= retina_image_tag 'foo.jpg', :alt => 'BrainHead', :class => 'some-class' %>
33
33
 
34
+ add :size => "@1x" so the foo@2x.jpg is the same size as foo.jpg
34
35
 
36
+ <%= retina_image_tag 'foo.jpg', :alt => 'BrainHead', :class => 'some-class', :size => "@1x" %>
35
37
 
36
38
 
37
39
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  module RetinaImageTag
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -5,11 +5,7 @@ module RetinaImageTag
5
5
 
6
6
 
7
7
  def retina_image( pixel_ratio )
8
-
9
- if @options[:size] == '@1x'
10
- @options[:size] = ImageSize.path(@rails_image_path+"/"+@file_name+@file_ext).size.to_s
11
- end
12
-
8
+
13
9
  if File.exist?(@rails_image_path+"/"+@file_name+"@#{pixel_ratio}x"+@file_ext)
14
10
  image_tag(@file_dirname+"/"+@file_name+"@#{pixel_ratio}x"+@file_ext, @options)
15
11
  else
@@ -27,7 +23,9 @@ module RetinaImageTag
27
23
  @file_name = File.basename(@file_path, @file_ext)
28
24
  @file_dirname = File.dirname(@file_path)
29
25
 
30
-
26
+ if @options[:size] == '@1x'
27
+ @options[:size] = ImageSize.path(@rails_image_path+"/"+@file_name+@file_ext).size.to_s
28
+ end
31
29
 
32
30
  @normal_image_tag = image_tag(@file_path, @options)
33
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retina_image_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: