jekyll-cloudinary 1.2.12 → 1.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -5
- data/lib/jekyll/cloudinary.rb +5 -3
- data/lib/jekyll/cloudinary/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6f0125c007baffaba36b821f460af3e35c4d73e
|
4
|
+
data.tar.gz: 191206258c2d9302ac85f2153d6a3efa2ded83b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af59ac2328ef55cf83eabf1342ad8f84fe00e5fd8ed74604c50b325a530e9fea07a8d07cc8b50286ca40480ed81dbe015ba100f1f2d8b608f9784e6dc15022e8
|
7
|
+
data.tar.gz: 3e6f9ef5d0e59cadf9205bec54d531a7cf4f7bed6f1131d961dd1a5ae40c5c2769e86213b50be7c6dc96ee360376ed300715b8bce840bdb71999f903324b987b
|
data/README.md
CHANGED
@@ -265,6 +265,8 @@ It generates these HTML fragments (pretty printed here), for the logo:
|
|
265
265
|
45vw"
|
266
266
|
class="logo"
|
267
267
|
alt="Logo de Cloudinary"
|
268
|
+
width="480"
|
269
|
+
height="350"
|
268
270
|
/>
|
269
271
|
```
|
270
272
|
|
@@ -277,17 +279,18 @@ And for the screenshot:
|
|
277
279
|
srcset="
|
278
280
|
https://res.cloudinary.com/nho/image/fetch/c_scale,w_320,q_auto,f_auto/https://nicolas-hoizey.com/2016/07/cloudinary-pricing.png 320w,
|
279
281
|
https://res.cloudinary.com/nho/image/fetch/c_scale,w_640,q_auto,f_auto/https://nicolas-hoizey.com/2016/07/cloudinary-pricing.png 640w,
|
280
|
-
https://res.cloudinary.com/nho/image/fetch/c_scale,w_960,q_auto,f_auto/https://nicolas-hoizey.com/2016/07/cloudinary-pricing.png 960w
|
281
|
-
|
282
|
-
|
283
|
-
90vw"
|
282
|
+
https://res.cloudinary.com/nho/image/fetch/c_scale,w_960,q_auto,f_auto/https://nicolas-hoizey.com/2016/07/cloudinary-pricing.png 960w,
|
283
|
+
https://res.cloudinary.com/nho/image/fetch/c_scale,w_1208,q_auto,f_auto/https://nicolas-hoizey.com/2016/07/cloudinary-pricing.png 1208w"
|
284
|
+
sizes="(min-width: 50rem) 50rem, 90vw"
|
284
285
|
alt="Les tarifs de Cloudinary"
|
286
|
+
width="1208"
|
287
|
+
height="561"
|
285
288
|
/>
|
286
289
|
<figcaption>Les tarifs de Cloudinary, dont l'offre gratuite déjà généreuse</figcaption>
|
287
290
|
</figure>
|
288
291
|
```
|
289
292
|
|
290
|
-
There are only
|
293
|
+
There are only 4 version in the `srcset` here because 2 of the 5 expected sizes are larger than the source image, and are replaced by one using the native source image width.
|
291
294
|
|
292
295
|
And here are the relevant parts of the accompanying CSS (in Sass form):
|
293
296
|
|
data/lib/jekyll/cloudinary.rb
CHANGED
@@ -64,11 +64,13 @@ module Jekyll
|
|
64
64
|
natural_width = image.columns
|
65
65
|
natural_height = image.rows
|
66
66
|
width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
|
67
|
+
fallback_url = "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{natural_width},q_auto,f_auto/#{image_url}"
|
67
68
|
else
|
68
69
|
natural_width = 100000
|
69
70
|
natural_height = 100000
|
70
71
|
width_height = ""
|
71
|
-
Jekyll.logger.warn('[Cloudinary]', "Couldn't find this image to check its width: #{image_path}")
|
72
|
+
Jekyll.logger.warn('[Cloudinary]', "Couldn't find this image to check its width: #{image_path}. Try to run Jekyll build a second time.")
|
73
|
+
fallback_url = "#{image_url}"
|
72
74
|
end
|
73
75
|
|
74
76
|
if markup[:preset]
|
@@ -156,9 +158,9 @@ module Jekyll
|
|
156
158
|
|
157
159
|
# preset['figure'] can be 'never', 'auto' or 'always'
|
158
160
|
if (caption || preset['figure'] == 'always') && preset['figure'] != 'never'
|
159
|
-
"\n<figure #{attr_string}>\n<img src=\"#{
|
161
|
+
"\n<figure #{attr_string}>\n<img src=\"#{fallback_url}\" srcset=\"#{srcset_string}\" sizes=\"#{sizes}\" #{img_attr} #{width_height} />\n<figcaption>#{caption}</figcaption>\n</figure>\n"
|
160
162
|
else
|
161
|
-
"<img src=\"#{
|
163
|
+
"<img src=\"#{fallback_url}\" srcset=\"#{srcset_string}\" sizes=\"#{sizes}\" #{attr_string} #{img_attr} #{width_height} />"
|
162
164
|
end
|
163
165
|
end
|
164
166
|
end
|