kamifusen 0.9.7 → 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +70 -65
- data/app/views/kamifusen/_view.html.erb +41 -18
- 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: 21b6ef8996df081487d71d6a914c245ab3fedb803a775ed1b4c10384b3f5a1df
|
|
4
|
+
data.tar.gz: 9e481700b2654d2bafae6cf79f6f4b44b7d4445407075283b7a2bd9a01200aea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fad6e4138146acb5e5afc4ad9b9522aad4179fecdd97dd97f822fcacac49eb8dcceaed6fde41ff09f397d8aa074f7366f28175fb3e26d62acc7fb7126065ff2a
|
|
7
|
+
data.tar.gz: ea01b9e4e5ca7d82e9e26f51907a62609a6c1edfcf994735031cd576810bdec80c23785b881609c3eaffecdb23d91d86b4ac7269305015093a5d3e9cc8364601
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
kamifusen (
|
|
4
|
+
kamifusen (1.4)
|
|
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)
|
|
12
|
+
actionpack (= 6.1.4)
|
|
13
|
+
activesupport (= 6.1.4)
|
|
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)
|
|
17
|
+
actionpack (= 6.1.4)
|
|
18
|
+
activejob (= 6.1.4)
|
|
19
|
+
activerecord (= 6.1.4)
|
|
20
|
+
activestorage (= 6.1.4)
|
|
21
|
+
activesupport (= 6.1.4)
|
|
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)
|
|
24
|
+
actionpack (= 6.1.4)
|
|
25
|
+
actionview (= 6.1.4)
|
|
26
|
+
activejob (= 6.1.4)
|
|
27
|
+
activesupport (= 6.1.4)
|
|
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)
|
|
31
|
+
actionview (= 6.1.4)
|
|
32
|
+
activesupport (= 6.1.4)
|
|
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)
|
|
38
|
+
actionpack (= 6.1.4)
|
|
39
|
+
activerecord (= 6.1.4)
|
|
40
|
+
activestorage (= 6.1.4)
|
|
41
|
+
activesupport (= 6.1.4)
|
|
42
42
|
nokogiri (>= 1.8.5)
|
|
43
|
-
actionview (6.1.
|
|
44
|
-
activesupport (= 6.1.
|
|
43
|
+
actionview (6.1.4)
|
|
44
|
+
activesupport (= 6.1.4)
|
|
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)
|
|
50
|
+
activesupport (= 6.1.4)
|
|
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)
|
|
53
|
+
activesupport (= 6.1.4)
|
|
54
|
+
activerecord (6.1.4)
|
|
55
|
+
activemodel (= 6.1.4)
|
|
56
|
+
activesupport (= 6.1.4)
|
|
57
|
+
activestorage (6.1.4)
|
|
58
|
+
actionpack (= 6.1.4)
|
|
59
|
+
activejob (= 6.1.4)
|
|
60
|
+
activerecord (= 6.1.4)
|
|
61
|
+
activesupport (= 6.1.4)
|
|
62
62
|
marcel (~> 1.0.0)
|
|
63
|
-
mini_mime (
|
|
64
|
-
activesupport (6.1.
|
|
63
|
+
mini_mime (>= 1.1.0)
|
|
64
|
+
activesupport (6.1.4)
|
|
65
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
66
66
|
i18n (>= 1.6, < 2)
|
|
67
67
|
minitest (>= 5.1)
|
|
@@ -69,10 +69,11 @@ GEM
|
|
|
69
69
|
zeitwerk (~> 2.3)
|
|
70
70
|
ast (2.4.2)
|
|
71
71
|
builder (3.2.4)
|
|
72
|
-
|
|
72
|
+
byebug (11.1.3)
|
|
73
|
+
concurrent-ruby (1.1.9)
|
|
73
74
|
crass (1.0.6)
|
|
74
75
|
erubi (1.10.0)
|
|
75
|
-
ffi (1.15.
|
|
76
|
+
ffi (1.15.3)
|
|
76
77
|
globalid (0.4.2)
|
|
77
78
|
activesupport (>= 4.2.0)
|
|
78
79
|
i18n (1.8.10)
|
|
@@ -83,7 +84,7 @@ GEM
|
|
|
83
84
|
listen (3.5.1)
|
|
84
85
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
85
86
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
86
|
-
loofah (2.
|
|
87
|
+
loofah (2.10.0)
|
|
87
88
|
crass (~> 1.0.2)
|
|
88
89
|
nokogiri (>= 1.5.9)
|
|
89
90
|
mail (2.7.1)
|
|
@@ -91,10 +92,12 @@ GEM
|
|
|
91
92
|
marcel (1.0.1)
|
|
92
93
|
method_source (1.0.0)
|
|
93
94
|
mini_magick (4.11.0)
|
|
94
|
-
mini_mime (1.0
|
|
95
|
+
mini_mime (1.1.0)
|
|
96
|
+
mini_portile2 (2.5.3)
|
|
95
97
|
minitest (5.14.4)
|
|
96
98
|
nio4r (2.5.7)
|
|
97
|
-
nokogiri (1.11.
|
|
99
|
+
nokogiri (1.11.7)
|
|
100
|
+
mini_portile2 (~> 2.5.0)
|
|
98
101
|
racc (~> 1.4)
|
|
99
102
|
parallel (1.20.1)
|
|
100
103
|
parser (3.0.1.1)
|
|
@@ -103,31 +106,31 @@ GEM
|
|
|
103
106
|
rack (2.2.3)
|
|
104
107
|
rack-test (1.1.0)
|
|
105
108
|
rack (>= 1.0, < 3)
|
|
106
|
-
rails (6.1.
|
|
107
|
-
actioncable (= 6.1.
|
|
108
|
-
actionmailbox (= 6.1.
|
|
109
|
-
actionmailer (= 6.1.
|
|
110
|
-
actionpack (= 6.1.
|
|
111
|
-
actiontext (= 6.1.
|
|
112
|
-
actionview (= 6.1.
|
|
113
|
-
activejob (= 6.1.
|
|
114
|
-
activemodel (= 6.1.
|
|
115
|
-
activerecord (= 6.1.
|
|
116
|
-
activestorage (= 6.1.
|
|
117
|
-
activesupport (= 6.1.
|
|
109
|
+
rails (6.1.4)
|
|
110
|
+
actioncable (= 6.1.4)
|
|
111
|
+
actionmailbox (= 6.1.4)
|
|
112
|
+
actionmailer (= 6.1.4)
|
|
113
|
+
actionpack (= 6.1.4)
|
|
114
|
+
actiontext (= 6.1.4)
|
|
115
|
+
actionview (= 6.1.4)
|
|
116
|
+
activejob (= 6.1.4)
|
|
117
|
+
activemodel (= 6.1.4)
|
|
118
|
+
activerecord (= 6.1.4)
|
|
119
|
+
activestorage (= 6.1.4)
|
|
120
|
+
activesupport (= 6.1.4)
|
|
118
121
|
bundler (>= 1.15.0)
|
|
119
|
-
railties (= 6.1.
|
|
122
|
+
railties (= 6.1.4)
|
|
120
123
|
sprockets-rails (>= 2.0.0)
|
|
121
124
|
rails-dom-testing (2.0.3)
|
|
122
125
|
activesupport (>= 4.2.0)
|
|
123
126
|
nokogiri (>= 1.6)
|
|
124
127
|
rails-html-sanitizer (1.3.0)
|
|
125
128
|
loofah (~> 2.3)
|
|
126
|
-
railties (6.1.
|
|
127
|
-
actionpack (= 6.1.
|
|
128
|
-
activesupport (= 6.1.
|
|
129
|
+
railties (6.1.4)
|
|
130
|
+
actionpack (= 6.1.4)
|
|
131
|
+
activesupport (= 6.1.4)
|
|
129
132
|
method_source
|
|
130
|
-
rake (>= 0.
|
|
133
|
+
rake (>= 0.13)
|
|
131
134
|
thor (~> 1.0)
|
|
132
135
|
rainbow (3.0.0)
|
|
133
136
|
rake (13.0.3)
|
|
@@ -136,16 +139,16 @@ GEM
|
|
|
136
139
|
ffi (~> 1.0)
|
|
137
140
|
regexp_parser (2.1.1)
|
|
138
141
|
rexml (3.2.5)
|
|
139
|
-
rubocop (1.
|
|
142
|
+
rubocop (1.18.2)
|
|
140
143
|
parallel (~> 1.10)
|
|
141
144
|
parser (>= 3.0.0.0)
|
|
142
145
|
rainbow (>= 2.2.2, < 4.0)
|
|
143
146
|
regexp_parser (>= 1.8, < 3.0)
|
|
144
147
|
rexml
|
|
145
|
-
rubocop-ast (>= 1.
|
|
148
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
|
146
149
|
ruby-progressbar (~> 1.7)
|
|
147
150
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
148
|
-
rubocop-ast (1.
|
|
151
|
+
rubocop-ast (1.7.0)
|
|
149
152
|
parser (>= 3.0.1.1)
|
|
150
153
|
ruby-progressbar (1.11.0)
|
|
151
154
|
ruby-vips (2.1.2)
|
|
@@ -162,15 +165,17 @@ GEM
|
|
|
162
165
|
tzinfo (2.0.4)
|
|
163
166
|
concurrent-ruby (~> 1.0)
|
|
164
167
|
unicode-display_width (2.0.0)
|
|
165
|
-
websocket-driver (0.7.
|
|
168
|
+
websocket-driver (0.7.5)
|
|
166
169
|
websocket-extensions (>= 0.1.0)
|
|
167
170
|
websocket-extensions (0.1.5)
|
|
168
171
|
zeitwerk (2.4.2)
|
|
169
172
|
|
|
170
173
|
PLATFORMS
|
|
174
|
+
ruby
|
|
171
175
|
x86_64-darwin-20
|
|
172
176
|
|
|
173
177
|
DEPENDENCIES
|
|
178
|
+
byebug
|
|
174
179
|
kamifusen!
|
|
175
180
|
listen
|
|
176
181
|
rake (~> 13.0)
|
|
@@ -2,16 +2,45 @@
|
|
|
2
2
|
# image_tag options
|
|
3
3
|
options ||= {}
|
|
4
4
|
alt = options[:alt]
|
|
5
|
+
klass = options[:class]
|
|
6
|
+
picture_class = options[:picture_class]
|
|
5
7
|
width = options[:width]
|
|
6
8
|
height = options[:height]
|
|
7
|
-
|
|
9
|
+
if source&.metadata &&
|
|
10
|
+
source.metadata['analyzed'] &&
|
|
11
|
+
source.metadata.has_key?('width') &&
|
|
12
|
+
source.metadata.has_key?('height')
|
|
13
|
+
image_width = source.metadata['width']
|
|
14
|
+
image_height = source.metadata['height']
|
|
15
|
+
image_ratio = 1.0 * image_width / image_height
|
|
16
|
+
if width.nil? && height.nil?
|
|
17
|
+
# Prendre width et height réelles de l'image
|
|
18
|
+
width = image_width
|
|
19
|
+
height = image_height
|
|
20
|
+
elsif width.nil?
|
|
21
|
+
# Calculer la height sur ratio
|
|
22
|
+
width = height * image_ratio
|
|
23
|
+
elsif height.nil?
|
|
24
|
+
# Calcule la width sur ratio
|
|
25
|
+
height = width / image_ratio
|
|
26
|
+
else
|
|
27
|
+
# Width et height sont explicites,
|
|
28
|
+
# si le ratio demandé n'est pas celui de l'image,
|
|
29
|
+
# Redéfinir la height
|
|
30
|
+
width = [image_width, width].min
|
|
31
|
+
height = width / image_ratio
|
|
32
|
+
end
|
|
33
|
+
width = width.round
|
|
34
|
+
height = height.round
|
|
35
|
+
end
|
|
8
36
|
parameters = " loading=\"lazy\" decoding=\"async\""
|
|
9
|
-
parameters += " alt=\"#{
|
|
10
|
-
parameters += " width=\"#{
|
|
11
|
-
parameters += " height=\"#{
|
|
12
|
-
parameters += " class=\"#{
|
|
37
|
+
parameters += " alt=\"#{ alt }\"" if alt
|
|
38
|
+
parameters += " width=\"#{ width }\"" if width
|
|
39
|
+
parameters += " height=\"#{ height }\"" if height
|
|
40
|
+
parameters += " class=\"#{ klass }\"" if klass
|
|
13
41
|
%>
|
|
14
42
|
<% if source.variable? %>
|
|
43
|
+
<%#= "#{image_width} x #{image_height}, #{image_ratio} ratio => #{width} x #{height}<br>".html_safe %>
|
|
15
44
|
<%
|
|
16
45
|
# kamifusen settings
|
|
17
46
|
sizes = [320, 576, 640, 768, 992, 1152, 1200, 1400, 1536, 1984, 2400]
|
|
@@ -19,15 +48,9 @@ parameters += " class=\"#{ options[:class] }\"" if klass
|
|
|
19
48
|
# Computing
|
|
20
49
|
if width
|
|
21
50
|
width_retina = width * 2
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
sizes.
|
|
25
|
-
# If the previous size was too big, we should reject this one
|
|
26
|
-
should_reject_this_size = size_is_too_big
|
|
27
|
-
# If this size is the first "too big" size, we should take it
|
|
28
|
-
size_is_too_big = size > width_retina
|
|
29
|
-
should_reject_this_size
|
|
30
|
-
end
|
|
51
|
+
sizes.reject! { |size| size > width_retina }
|
|
52
|
+
sizes << width_retina
|
|
53
|
+
sizes.uniq!
|
|
31
54
|
end
|
|
32
55
|
default_width = sizes.max
|
|
33
56
|
default_width = width_retina if width_retina && width_retina > default_width
|
|
@@ -41,14 +64,14 @@ parameters += " class=\"#{ options[:class] }\"" if klass
|
|
|
41
64
|
}.join(', ')
|
|
42
65
|
default = url_for source.variant(resize: "#{default_width}>", quality: quality)
|
|
43
66
|
%>
|
|
44
|
-
<picture
|
|
67
|
+
<picture<%= " class=\"#{picture_class}\"".html_safe unless picture_class.blank? %>>
|
|
45
68
|
<% if Kamifusen.with_webp %>
|
|
46
|
-
<source srcset="<%= srcset_webp %>">
|
|
69
|
+
<source srcset="<%= srcset_webp %>" type="image/webp">
|
|
47
70
|
<% end %>
|
|
48
|
-
<img src="<%= default %>" srcset="<%= srcset_default %>"<%= raw parameters %>>
|
|
71
|
+
<img src="<%= default %>" srcset="<%= srcset_default %>" type="<%= source.content_type %>"<%= raw parameters %>>
|
|
49
72
|
</picture>
|
|
50
73
|
<% else %>
|
|
51
74
|
<picture>
|
|
52
|
-
<img src="<%= url_for source %>"<%= raw parameters %>>
|
|
75
|
+
<img src="<%= url_for source %>" type="<%= source.content_type %>"<%= raw parameters %>>
|
|
53
76
|
</picture>
|
|
54
77
|
<% 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:
|
|
4
|
+
version: '1.4'
|
|
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-07-07 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
|