jekyll-cloudinary 1.5.2 → 1.6.0

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
  SHA1:
3
- metadata.gz: a32c2a7afd71bd1b4558a21ca92bdf577ef5d604
4
- data.tar.gz: 6360f0555e00eec720ad2eab186e81412fb8362b
3
+ metadata.gz: f72e7653facaf897ebb3b54dfbebbb08dd7382e7
4
+ data.tar.gz: 5f826cac5b07094b25965c88a3a9cacb98dfc6b8
5
5
  SHA512:
6
- metadata.gz: 82f673fa5c1ce36c187ffd48fe0075870e02c0d0f4d7ae055a7fe469067284e7d73ee1b401108f765f0b2630da3e2080413aa07dbcfbd7cc72f268f1d4bb0fcd
7
- data.tar.gz: d86d4f0b9f2ef8cc2a2f5feb0f84201a34803d6f342d3b2ed151509a4c67a61a8c2e1ded61f2970741aa094b5aad4c9a4e6d4a38a59befee351cf2de1e53076b
6
+ metadata.gz: b4bb1dd01c1efe5efd65ffab49da2e514cbb1956507433d8cccc7a149f4869d89c369c2b79b047fe7e86abb47d4eb5ccd0b97c8c9b2fc4e77e5872faf24a990b
7
+ data.tar.gz: a0522ff16af54368f09b8e1ec44454ab5b6ca5c45b1afebe5912b06bd9f846e2b6eab53f4699a66e540c28585a44b81a80217cb0274e9a749a627cb703ff7261
@@ -76,24 +76,6 @@ module Jekyll
76
76
  )
77
77
  end
78
78
 
79
- # Get source image natural width
80
- if File.exist?(image_path)
81
- image = Magick::Image::read(image_path).first
82
- natural_width = image.columns
83
- natural_height = image.rows
84
- width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
85
- fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/fetch/c_limit,w_#{preset["fallback_max_width"]},q_auto,f_auto/#{image_url}"
86
- else
87
- natural_width = 100_000
88
- width_height = ""
89
- Jekyll.logger.warn(
90
- "[Cloudinary]",
91
- "Couldn't find this image to check its width: #{image_path}. \
92
- Try to run Jekyll build a second time."
93
- )
94
- fallback_url = image_url
95
- end
96
-
97
79
  if markup[:preset]
98
80
  if settings["presets"][markup[:preset]]
99
81
  preset = preset.merge(settings["presets"][markup[:preset]])
@@ -147,6 +129,24 @@ module Jekyll
147
129
 
148
130
  attr_string = html_attr.map { |a, v| "#{a}=\"#{v}\"" }.join(" ")
149
131
 
132
+ # Get source image natural width
133
+ if File.exist?(image_path)
134
+ image = Magick::Image::read(image_path).first
135
+ natural_width = image.columns
136
+ natural_height = image.rows
137
+ width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
138
+ fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/fetch/c_limit,w_#{preset["fallback_max_width"]},q_auto,f_auto/#{image_url}"
139
+ else
140
+ natural_width = 100_000
141
+ width_height = ""
142
+ Jekyll.logger.warn(
143
+ "[Cloudinary]",
144
+ "Couldn't find this image to check its width: #{image_path}. \
145
+ Try to run Jekyll build a second time."
146
+ )
147
+ fallback_url = image_url
148
+ end
149
+
150
150
  srcset = []
151
151
  steps = preset["steps"].to_i
152
152
  min_width = preset["min_width"].to_i
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Cloudinary
3
- VERSION = "1.5.2".freeze
3
+ VERSION = "1.6.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Hoizey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll