kamifusen 1.1 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +70 -67
- data/README.md +2 -0
- data/app/views/kamifusen/_view.html.erb +38 -7
- data/lib/kamifusen/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b297bc21e758df40da735dee289c75adf846daf1fc4d11c88aa041b9985cf4e
|
4
|
+
data.tar.gz: 62322fa18a71d6297fff797b91fcbc3ce06103bd20327b262b08be8d6d6f11a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48dd1181ec937589ded1d25f5897f99e9ce2a52714f7239c6f8dca14db443cc9fa22ca11f8301a1de66d624e974a9e1d182aafe0b1b307757ecbe256c592c8fd
|
7
|
+
data.tar.gz: 817ec1062b6b0b44f264182b2ba3af016f43fe77c7ac87dd640210d81798ee901c4e2895ef4d841b229ef8e2a78629fb58d0f6f2f1b1527251974790065fabdd
|
data/Gemfile.lock
CHANGED
@@ -1,67 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kamifusen (1.
|
4
|
+
kamifusen (1.5)
|
5
5
|
image_processing
|
6
6
|
rails
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.1.
|
12
|
-
actionpack (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
11
|
+
actioncable (6.1.4.1)
|
12
|
+
actionpack (= 6.1.4.1)
|
13
|
+
activesupport (= 6.1.4.1)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.1.
|
17
|
-
actionpack (= 6.1.
|
18
|
-
activejob (= 6.1.
|
19
|
-
activerecord (= 6.1.
|
20
|
-
activestorage (= 6.1.
|
21
|
-
activesupport (= 6.1.
|
16
|
+
actionmailbox (6.1.4.1)
|
17
|
+
actionpack (= 6.1.4.1)
|
18
|
+
activejob (= 6.1.4.1)
|
19
|
+
activerecord (= 6.1.4.1)
|
20
|
+
activestorage (= 6.1.4.1)
|
21
|
+
activesupport (= 6.1.4.1)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.1.
|
24
|
-
actionpack (= 6.1.
|
25
|
-
actionview (= 6.1.
|
26
|
-
activejob (= 6.1.
|
27
|
-
activesupport (= 6.1.
|
23
|
+
actionmailer (6.1.4.1)
|
24
|
+
actionpack (= 6.1.4.1)
|
25
|
+
actionview (= 6.1.4.1)
|
26
|
+
activejob (= 6.1.4.1)
|
27
|
+
activesupport (= 6.1.4.1)
|
28
28
|
mail (~> 2.5, >= 2.5.4)
|
29
29
|
rails-dom-testing (~> 2.0)
|
30
|
-
actionpack (6.1.
|
31
|
-
actionview (= 6.1.
|
32
|
-
activesupport (= 6.1.
|
30
|
+
actionpack (6.1.4.1)
|
31
|
+
actionview (= 6.1.4.1)
|
32
|
+
activesupport (= 6.1.4.1)
|
33
33
|
rack (~> 2.0, >= 2.0.9)
|
34
34
|
rack-test (>= 0.6.3)
|
35
35
|
rails-dom-testing (~> 2.0)
|
36
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
-
actiontext (6.1.
|
38
|
-
actionpack (= 6.1.
|
39
|
-
activerecord (= 6.1.
|
40
|
-
activestorage (= 6.1.
|
41
|
-
activesupport (= 6.1.
|
37
|
+
actiontext (6.1.4.1)
|
38
|
+
actionpack (= 6.1.4.1)
|
39
|
+
activerecord (= 6.1.4.1)
|
40
|
+
activestorage (= 6.1.4.1)
|
41
|
+
activesupport (= 6.1.4.1)
|
42
42
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (6.1.
|
44
|
-
activesupport (= 6.1.
|
43
|
+
actionview (6.1.4.1)
|
44
|
+
activesupport (= 6.1.4.1)
|
45
45
|
builder (~> 3.1)
|
46
46
|
erubi (~> 1.4)
|
47
47
|
rails-dom-testing (~> 2.0)
|
48
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (6.1.
|
50
|
-
activesupport (= 6.1.
|
49
|
+
activejob (6.1.4.1)
|
50
|
+
activesupport (= 6.1.4.1)
|
51
51
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (6.1.
|
53
|
-
activesupport (= 6.1.
|
54
|
-
activerecord (6.1.
|
55
|
-
activemodel (= 6.1.
|
56
|
-
activesupport (= 6.1.
|
57
|
-
activestorage (6.1.
|
58
|
-
actionpack (= 6.1.
|
59
|
-
activejob (= 6.1.
|
60
|
-
activerecord (= 6.1.
|
61
|
-
activesupport (= 6.1.
|
52
|
+
activemodel (6.1.4.1)
|
53
|
+
activesupport (= 6.1.4.1)
|
54
|
+
activerecord (6.1.4.1)
|
55
|
+
activemodel (= 6.1.4.1)
|
56
|
+
activesupport (= 6.1.4.1)
|
57
|
+
activestorage (6.1.4.1)
|
58
|
+
actionpack (= 6.1.4.1)
|
59
|
+
activejob (= 6.1.4.1)
|
60
|
+
activerecord (= 6.1.4.1)
|
61
|
+
activesupport (= 6.1.4.1)
|
62
62
|
marcel (~> 1.0.0)
|
63
|
-
mini_mime (
|
64
|
-
activesupport (6.1.
|
63
|
+
mini_mime (>= 1.1.0)
|
64
|
+
activesupport (6.1.4.1)
|
65
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
66
|
i18n (>= 1.6, < 2)
|
67
67
|
minitest (>= 5.1)
|
@@ -73,9 +73,9 @@ GEM
|
|
73
73
|
concurrent-ruby (1.1.9)
|
74
74
|
crass (1.0.6)
|
75
75
|
erubi (1.10.0)
|
76
|
-
ffi (1.15.
|
77
|
-
globalid (0.
|
78
|
-
activesupport (>=
|
76
|
+
ffi (1.15.3)
|
77
|
+
globalid (0.5.2)
|
78
|
+
activesupport (>= 5.0)
|
79
79
|
i18n (1.8.10)
|
80
80
|
concurrent-ruby (~> 1.0)
|
81
81
|
image_processing (1.12.1)
|
@@ -84,7 +84,7 @@ GEM
|
|
84
84
|
listen (3.5.1)
|
85
85
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
86
86
|
rb-inotify (~> 0.9, >= 0.9.10)
|
87
|
-
loofah (2.
|
87
|
+
loofah (2.12.0)
|
88
88
|
crass (~> 1.0.2)
|
89
89
|
nokogiri (>= 1.5.9)
|
90
90
|
mail (2.7.1)
|
@@ -92,10 +92,12 @@ GEM
|
|
92
92
|
marcel (1.0.1)
|
93
93
|
method_source (1.0.0)
|
94
94
|
mini_magick (4.11.0)
|
95
|
-
mini_mime (1.
|
95
|
+
mini_mime (1.1.1)
|
96
|
+
mini_portile2 (2.6.1)
|
96
97
|
minitest (5.14.4)
|
97
|
-
nio4r (2.5.
|
98
|
-
nokogiri (1.
|
98
|
+
nio4r (2.5.8)
|
99
|
+
nokogiri (1.12.4)
|
100
|
+
mini_portile2 (~> 2.6.1)
|
99
101
|
racc (~> 1.4)
|
100
102
|
parallel (1.20.1)
|
101
103
|
parser (3.0.1.1)
|
@@ -104,31 +106,31 @@ GEM
|
|
104
106
|
rack (2.2.3)
|
105
107
|
rack-test (1.1.0)
|
106
108
|
rack (>= 1.0, < 3)
|
107
|
-
rails (6.1.
|
108
|
-
actioncable (= 6.1.
|
109
|
-
actionmailbox (= 6.1.
|
110
|
-
actionmailer (= 6.1.
|
111
|
-
actionpack (= 6.1.
|
112
|
-
actiontext (= 6.1.
|
113
|
-
actionview (= 6.1.
|
114
|
-
activejob (= 6.1.
|
115
|
-
activemodel (= 6.1.
|
116
|
-
activerecord (= 6.1.
|
117
|
-
activestorage (= 6.1.
|
118
|
-
activesupport (= 6.1.
|
109
|
+
rails (6.1.4.1)
|
110
|
+
actioncable (= 6.1.4.1)
|
111
|
+
actionmailbox (= 6.1.4.1)
|
112
|
+
actionmailer (= 6.1.4.1)
|
113
|
+
actionpack (= 6.1.4.1)
|
114
|
+
actiontext (= 6.1.4.1)
|
115
|
+
actionview (= 6.1.4.1)
|
116
|
+
activejob (= 6.1.4.1)
|
117
|
+
activemodel (= 6.1.4.1)
|
118
|
+
activerecord (= 6.1.4.1)
|
119
|
+
activestorage (= 6.1.4.1)
|
120
|
+
activesupport (= 6.1.4.1)
|
119
121
|
bundler (>= 1.15.0)
|
120
|
-
railties (= 6.1.
|
122
|
+
railties (= 6.1.4.1)
|
121
123
|
sprockets-rails (>= 2.0.0)
|
122
124
|
rails-dom-testing (2.0.3)
|
123
125
|
activesupport (>= 4.2.0)
|
124
126
|
nokogiri (>= 1.6)
|
125
|
-
rails-html-sanitizer (1.
|
127
|
+
rails-html-sanitizer (1.4.2)
|
126
128
|
loofah (~> 2.3)
|
127
|
-
railties (6.1.
|
128
|
-
actionpack (= 6.1.
|
129
|
-
activesupport (= 6.1.
|
129
|
+
railties (6.1.4.1)
|
130
|
+
actionpack (= 6.1.4.1)
|
131
|
+
activesupport (= 6.1.4.1)
|
130
132
|
method_source
|
131
|
-
rake (>= 0.
|
133
|
+
rake (>= 0.13)
|
132
134
|
thor (~> 1.0)
|
133
135
|
rainbow (3.0.0)
|
134
136
|
rake (13.0.3)
|
@@ -137,7 +139,7 @@ GEM
|
|
137
139
|
ffi (~> 1.0)
|
138
140
|
regexp_parser (2.1.1)
|
139
141
|
rexml (3.2.5)
|
140
|
-
rubocop (1.
|
142
|
+
rubocop (1.18.2)
|
141
143
|
parallel (~> 1.10)
|
142
144
|
parser (>= 3.0.0.0)
|
143
145
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -149,7 +151,7 @@ GEM
|
|
149
151
|
rubocop-ast (1.7.0)
|
150
152
|
parser (>= 3.0.1.1)
|
151
153
|
ruby-progressbar (1.11.0)
|
152
|
-
ruby-vips (2.1.
|
154
|
+
ruby-vips (2.1.3)
|
153
155
|
ffi (~> 1.12)
|
154
156
|
sprockets (4.0.2)
|
155
157
|
concurrent-ruby (~> 1.0)
|
@@ -163,12 +165,13 @@ GEM
|
|
163
165
|
tzinfo (2.0.4)
|
164
166
|
concurrent-ruby (~> 1.0)
|
165
167
|
unicode-display_width (2.0.0)
|
166
|
-
websocket-driver (0.7.
|
168
|
+
websocket-driver (0.7.5)
|
167
169
|
websocket-extensions (>= 0.1.0)
|
168
170
|
websocket-extensions (0.1.5)
|
169
171
|
zeitwerk (2.4.2)
|
170
172
|
|
171
173
|
PLATFORMS
|
174
|
+
ruby
|
172
175
|
x86_64-darwin-20
|
173
176
|
|
174
177
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Kamifūsen
|
2
2
|
|
3
|
+
Images in Ruby on Rails, as lightweight as possible!
|
4
|
+
|
3
5
|
![Kamifūsen in Yamagata](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/%E4%B8%AD%E6%B4%A5%E5%B7%9D%E9%9B%AA%E3%81%BE%E3%81%A4%E3%82%8A.jpg/1024px-%E4%B8%AD%E6%B4%A5%E5%B7%9D%E9%9B%AA%E3%81%BE%E3%81%A4%E3%82%8A.jpg)
|
4
6
|
|
5
7
|
## Installation
|
@@ -2,16 +2,47 @@
|
|
2
2
|
# image_tag options
|
3
3
|
options ||= {}
|
4
4
|
alt = options[:alt]
|
5
|
+
async = options[:sync] || true
|
6
|
+
klass = options[:class]
|
7
|
+
picture_class = options[:picture_class]
|
5
8
|
width = options[:width]
|
6
9
|
height = options[:height]
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
if source&.metadata &&
|
11
|
+
source.metadata['analyzed'] &&
|
12
|
+
source.metadata.has_key?('width') &&
|
13
|
+
source.metadata.has_key?('height')
|
14
|
+
image_width = source.metadata['width']
|
15
|
+
image_height = source.metadata['height']
|
16
|
+
image_ratio = 1.0 * image_width / image_height
|
17
|
+
if width.nil? && height.nil?
|
18
|
+
# Prendre width et height réelles de l'image
|
19
|
+
width = image_width
|
20
|
+
height = image_height
|
21
|
+
elsif width.nil?
|
22
|
+
# Calculer la height sur ratio
|
23
|
+
width = height * image_ratio
|
24
|
+
elsif height.nil?
|
25
|
+
# Calcule la width sur ratio
|
26
|
+
height = width / image_ratio
|
27
|
+
else
|
28
|
+
# Width et height sont explicites,
|
29
|
+
# si le ratio demandé n'est pas celui de l'image,
|
30
|
+
# Redéfinir la height
|
31
|
+
width = [image_width, width].min
|
32
|
+
height = width / image_ratio
|
33
|
+
end
|
34
|
+
width = width.round
|
35
|
+
height = height.round
|
36
|
+
end
|
37
|
+
parameters = " "
|
38
|
+
parameters = " loading=\"lazy\" decoding=\"async\"" if async
|
39
|
+
parameters += " alt=\"#{ alt }\"" if alt
|
40
|
+
parameters += " width=\"#{ width }\"" if width
|
41
|
+
parameters += " height=\"#{ height }\"" if height
|
42
|
+
parameters += " class=\"#{ klass }\"" if klass
|
13
43
|
%>
|
14
44
|
<% if source.variable? %>
|
45
|
+
<%#= "#{image_width} x #{image_height}, #{image_ratio} ratio => #{width} x #{height}<br>".html_safe %>
|
15
46
|
<%
|
16
47
|
# kamifusen settings
|
17
48
|
sizes = [320, 576, 640, 768, 992, 1152, 1200, 1400, 1536, 1984, 2400]
|
@@ -35,7 +66,7 @@ parameters += " class=\"#{ options[:class] }\"" if klass
|
|
35
66
|
}.join(', ')
|
36
67
|
default = url_for source.variant(resize: "#{default_width}>", quality: quality)
|
37
68
|
%>
|
38
|
-
<picture
|
69
|
+
<picture<%= " class=\"#{picture_class}\"".html_safe unless picture_class.blank? %>>
|
39
70
|
<% if Kamifusen.with_webp %>
|
40
71
|
<source srcset="<%= srcset_webp %>" type="image/webp">
|
41
72
|
<% end %>
|
data/lib/kamifusen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamifusen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sébastien Moulène
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
rubygems_version: 3.1.
|
119
|
+
rubygems_version: 3.1.6
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Images, light as balloons
|