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 +3 -1
- data/lib/retina_image_tag/version.rb +1 -1
- data/lib/retina_image_tag/view_helpers.rb +4 -6
- metadata +1 -1
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
|
@@ -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
|
|