kamifusen 1.10 → 1.10.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.lock +13 -13
- data/README.md +8 -1
- data/app/views/kamifusen/_view.html.erb +8 -8
- data/lib/kamifusen/version.rb +1 -1
- data/lib/kamifusen.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12d0c2903826a900723af0aea99336e6aef512e3cae4766909dad2e50093ac9f
|
4
|
+
data.tar.gz: 5e1218d9d960bed50bc598a7f7242f0535544696ae7e094e232167607bc45a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cf98152843c87b024b750edee24772bbba61f63045834b3ba631b1eb6cb4c7cccfe603b8c0f054ad118de7ea31ed54b6324f84f24daee5a4fd922ac65521b8b
|
7
|
+
data.tar.gz: 39887ba0a9fea2680d3d9f469e7498d77743960b56412603f8ee7e9a318d0ccfb83972ec02b7b3988b5c9c513b17c28796d5beb5e571073751b8e8f6e53ac3db
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kamifusen (1.10)
|
4
|
+
kamifusen (1.10.4)
|
5
5
|
image_processing
|
6
6
|
rails
|
7
7
|
|
@@ -73,7 +73,7 @@ GEM
|
|
73
73
|
concurrent-ruby (1.1.9)
|
74
74
|
crass (1.0.6)
|
75
75
|
erubi (1.10.0)
|
76
|
-
ffi (1.15.
|
76
|
+
ffi (1.15.4)
|
77
77
|
globalid (0.5.2)
|
78
78
|
activesupport (>= 5.0)
|
79
79
|
i18n (1.8.11)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
image_processing (1.12.1)
|
82
82
|
mini_magick (>= 4.9.5, < 5)
|
83
83
|
ruby-vips (>= 2.0.17, < 3)
|
84
|
-
listen (3.
|
84
|
+
listen (3.7.0)
|
85
85
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
86
86
|
rb-inotify (~> 0.9, >= 0.9.10)
|
87
87
|
loofah (2.12.0)
|
@@ -101,8 +101,8 @@ GEM
|
|
101
101
|
racc (~> 1.4)
|
102
102
|
nokogiri (1.12.5-x86_64-darwin)
|
103
103
|
racc (~> 1.4)
|
104
|
-
parallel (1.
|
105
|
-
parser (3.0.
|
104
|
+
parallel (1.21.0)
|
105
|
+
parser (3.0.2.0)
|
106
106
|
ast (~> 2.4.1)
|
107
107
|
racc (1.6.0)
|
108
108
|
rack (2.2.3)
|
@@ -135,22 +135,22 @@ GEM
|
|
135
135
|
rake (>= 0.13)
|
136
136
|
thor (~> 1.0)
|
137
137
|
rainbow (3.0.0)
|
138
|
-
rake (13.0.
|
138
|
+
rake (13.0.6)
|
139
139
|
rb-fsevent (0.11.0)
|
140
140
|
rb-inotify (0.10.1)
|
141
141
|
ffi (~> 1.0)
|
142
142
|
regexp_parser (2.1.1)
|
143
143
|
rexml (3.2.5)
|
144
|
-
rubocop (1.
|
144
|
+
rubocop (1.23.0)
|
145
145
|
parallel (~> 1.10)
|
146
146
|
parser (>= 3.0.0.0)
|
147
147
|
rainbow (>= 2.2.2, < 4.0)
|
148
148
|
regexp_parser (>= 1.8, < 3.0)
|
149
149
|
rexml
|
150
|
-
rubocop-ast (>= 1.
|
150
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
151
151
|
ruby-progressbar (~> 1.7)
|
152
152
|
unicode-display_width (>= 1.4.0, < 3.0)
|
153
|
-
rubocop-ast (1.
|
153
|
+
rubocop-ast (1.13.0)
|
154
154
|
parser (>= 3.0.1.1)
|
155
155
|
ruby-progressbar (1.11.0)
|
156
156
|
ruby-vips (2.1.3)
|
@@ -158,15 +158,15 @@ GEM
|
|
158
158
|
sprockets (4.0.2)
|
159
159
|
concurrent-ruby (~> 1.0)
|
160
160
|
rack (> 1, < 3)
|
161
|
-
sprockets-rails (3.
|
162
|
-
actionpack (>=
|
163
|
-
activesupport (>=
|
161
|
+
sprockets-rails (3.4.0)
|
162
|
+
actionpack (>= 5.2)
|
163
|
+
activesupport (>= 5.2)
|
164
164
|
sprockets (>= 3.0.0)
|
165
165
|
sqlite3 (1.4.2)
|
166
166
|
thor (1.1.0)
|
167
167
|
tzinfo (2.0.4)
|
168
168
|
concurrent-ruby (~> 1.0)
|
169
|
-
unicode-display_width (2.
|
169
|
+
unicode-display_width (2.1.0)
|
170
170
|
websocket-driver (0.7.5)
|
171
171
|
websocket-extensions (>= 0.1.0)
|
172
172
|
websocket-extensions (0.1.5)
|
data/README.md
CHANGED
@@ -32,6 +32,13 @@ If you want to disable webp, in config/initializers/kamifusen.rb:
|
|
32
32
|
Kamifusen.with_webp = false
|
33
33
|
```
|
34
34
|
|
35
|
+
If you render kamifusen tags inside a sanitized text, please make sure you allow these tags and attributes in `config/application.yml`:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
config.action_view.sanitized_allowed_tags = ['picture', 'source', 'img']
|
39
|
+
config.action_view.sanitized_allowed_attributes = ['src', 'type', 'srcset', 'width', 'height', 'alt', 'sizes', 'loading', 'decoding']
|
40
|
+
```
|
41
|
+
|
35
42
|
## Usage
|
36
43
|
|
37
44
|
Simply use `kamifusen_tag` instead of `image_tag` in your rails views.## What's the problem?
|
@@ -103,7 +110,7 @@ Webp and AVIF are more efficient formats than jpg and png. They allow better com
|
|
103
110
|
|
104
111
|
### The final situation
|
105
112
|
|
106
|
-
https://
|
113
|
+
https://noesya.github.io/kamifusen/
|
107
114
|
|
108
115
|
The new helper is:
|
109
116
|
|
@@ -12,6 +12,7 @@ variant_sizes = Kamifusen.sizes.dup
|
|
12
12
|
quality = Kamifusen.quality.dup
|
13
13
|
|
14
14
|
sizes = options[:sizes] || {}
|
15
|
+
sizes_value = sizes.map { |key, value| [key, value].join(' ').strip }.join(', ')
|
15
16
|
|
16
17
|
if source&.analyzed? && source.metadata.has_key?('width') && source.metadata.has_key?('height')
|
17
18
|
image_width = source.metadata['width']
|
@@ -20,7 +21,7 @@ if source&.analyzed? && source.metadata.has_key?('width') && source.metadata.has
|
|
20
21
|
if width.nil? && height.nil?
|
21
22
|
# Image real dimensions
|
22
23
|
width = [image_width, variant_sizes.last].min
|
23
|
-
height = width
|
24
|
+
height = width / image_ratio
|
24
25
|
elsif width.nil?
|
25
26
|
# Calculated width, preserving the aspect ratio
|
26
27
|
width = height * image_ratio
|
@@ -85,14 +86,13 @@ end
|
|
85
86
|
<picture<%= " class=\"#{picture_class}\"".html_safe unless picture_class.blank? %>>
|
86
87
|
<% if Kamifusen.with_webp %>
|
87
88
|
<source srcset="<%= srcset_webp %>"
|
88
|
-
|
89
|
-
|
89
|
+
<%= " sizes=\"#{sizes_value}\"".html_safe unless sizes.empty? %>
|
90
|
+
type="image/webp">
|
90
91
|
<% end %>
|
91
|
-
<
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<%= raw parameters %>>
|
92
|
+
<source srcset="<%= srcset_default %>"
|
93
|
+
<%= " sizes=\"#{sizes_value}\"".html_safe unless sizes.empty? %>
|
94
|
+
type="<%= source.content_type %>">
|
95
|
+
<img src="<%= default %>" <%= raw parameters %>>
|
96
96
|
</picture>
|
97
97
|
<% else %>
|
98
98
|
<picture>
|
data/lib/kamifusen/version.rb
CHANGED
data/lib/kamifusen.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.10.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-11-
|
12
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|