kamifusen 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a689acadb87e346abfda6e357a1de05daf496622275dacc35d4b1f4c3464f3f9
4
- data.tar.gz: e21c4b4e6048ea0ba35709bfad5b364e2292ac9cbb7767c655b51d2913e63fd8
3
+ metadata.gz: 2664cf5dea01a7294d0f2c9b017b2d6bd00a3d0a81daaa161f95f924ee62479e
4
+ data.tar.gz: 5301c3d3ad0733b2a7376f3a8a417b4a02d74c59eebf35f5cde3906e2e179523
5
5
  SHA512:
6
- metadata.gz: d44f3179b6a02b35c880d083a9b8a4232ee14e01564ef29017a45430f0acfcac328fac44b5d374dd32ecbb69de4ebd5e463d9351279404fabe5840126352c7a4
7
- data.tar.gz: 46501974677fab6ae5749705991dded8bdfddd0b223e76b8eea9048eb67ee642f942ad99df046bd26e57f4728d38e7c7684faea09cfa75f1a0b7fdc19d48e6b4
6
+ metadata.gz: 3c06c337ed793d477bd3dd9539517c4ba09011e8c0e801b084e8ae477991dc168f45d63165fa4754170003b60aab1ce0ef886eacd98bf2a80823f9dc7ab81eda
7
+ data.tar.gz: 69acef22af9cb3beb364f593f7fb6005e564f3f93ec95af6005bf3255b166715cb79f11fd3253e56f1fc0e3b1c6cb09f1d171126236a148bb180b737736fa5a0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kamifusen (0.9.6)
4
+ kamifusen (0.9.7)
5
5
  image_processing
6
6
  rails
7
7
 
@@ -17,7 +17,20 @@ parameters += " class=\"#{ options[:class] }\"" if klass
17
17
  sizes = [320, 576, 640, 768, 992, 1152, 1200, 1400, 1536, 1984, 2400]
18
18
  quality = 80
19
19
  # Computing
20
- sizes.reject! { |size| size > width * 2 } if width
20
+ if width
21
+ width_retina = width * 2
22
+ # If we ask for a 175px width, we should have 320 and 576 sizes
23
+ size_is_too_big = false
24
+ sizes.reject! do |size|
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
31
+ end
32
+ default_width = sizes.max
33
+ default_width = width_retina if width_retina && width_retina > default_width
21
34
  if Kamifusen.with_webp
22
35
  srcset_webp = sizes.map { |size|
23
36
  "#{ url_for source.variant(resize: "#{size}>", format: :webp, quality: quality) } #{ size }w"
@@ -26,7 +39,7 @@ parameters += " class=\"#{ options[:class] }\"" if klass
26
39
  srcset_default = sizes.map { |size|
27
40
  "#{ url_for source.variant(resize: "#{size}>", quality: quality) } #{ size }w"
28
41
  }.join(', ')
29
- default = url_for source.variant(resize: "#{sizes.max}>", quality: quality)
42
+ default = url_for source.variant(resize: "#{default_width}>", quality: quality)
30
43
  %>
31
44
  <picture>
32
45
  <% if Kamifusen.with_webp %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kamifusen
4
- VERSION = "0.9.6"
4
+ VERSION = "0.9.7"
5
5
  end
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: 0.9.6
4
+ version: 0.9.7
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-06-01 00:00:00.000000000 Z
12
+ date: 2021-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails