jekyll-cloudinary 1.7.0 → 1.8.0
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/lib/jekyll/cloudinary.rb +13 -36
- data/lib/jekyll/cloudinary/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcb506d3d31f2cbb0c1e42c71b777040d36d2e87
|
4
|
+
data.tar.gz: 13f1c330a526d3b0473d696f0e1702fdaeaf6cb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56796326a51cb7b5f018388528a95a73ab2ba7b0caeba093408936e358f8abb653d8a703fae160ee618a694f09535bc2ed3f2b0a71d92301fe717a7d06dc4235
|
7
|
+
data.tar.gz: bfa956919aa696576e0fb49743159dcac92f2e8f6ce3808b09d6f1a1bda979e31e4ae67b44c4197c7131027804f23fa916f6b505583c93b7b15b2d3fa3eba5ac
|
data/lib/jekyll/cloudinary.rb
CHANGED
@@ -2,8 +2,7 @@ module Jekyll
|
|
2
2
|
module Cloudinary
|
3
3
|
|
4
4
|
class CloudinaryTag < Liquid::Tag
|
5
|
-
require "
|
6
|
-
require "open-uri"
|
5
|
+
require "fastimage"
|
7
6
|
|
8
7
|
def initialize(tag_name, markup, tokens)
|
9
8
|
@markup = markup
|
@@ -218,41 +217,19 @@ module Jekyll
|
|
218
217
|
end
|
219
218
|
|
220
219
|
# Get source image natural width
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
# Trap format support issues from ImageMagick
|
228
|
-
begin
|
229
|
-
if is_image_remote
|
230
|
-
image = Magick::ImageList.new
|
231
|
-
urlimage = open(image_url) # Image Remote URL
|
232
|
-
image.from_blob(urlimage.read)
|
233
|
-
elsif File.exist?(image_path)
|
234
|
-
image = Magick::Image::read(image_path).first
|
235
|
-
end
|
236
|
-
rescue
|
237
|
-
image = false
|
238
|
-
end
|
239
|
-
if image
|
240
|
-
natural_width = image.columns
|
241
|
-
natural_height = image.rows
|
242
|
-
width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
|
243
|
-
else
|
244
|
-
fallback_url = image_url
|
245
|
-
Jekyll.logger.warn(
|
246
|
-
"[Cloudinary]",
|
247
|
-
"Couldn't find this image to check its width: #{image_path}. \
|
248
|
-
Try to run Jekyll build a second time. If it still doesn’t work \
|
249
|
-
it could be that your ImageMagick install doesn’t support this format."
|
250
|
-
)
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
if preset["width_height"] == false
|
220
|
+
if File.exist?(image_path)
|
221
|
+
natural_width, natural_height = FastImage.size(image_url)
|
222
|
+
width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
|
223
|
+
fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{preset["fallback_max_width"]}/#{image_url}"
|
224
|
+
else
|
225
|
+
natural_width = 100_000
|
255
226
|
width_height = ""
|
227
|
+
Jekyll.logger.warn(
|
228
|
+
"[Cloudinary]",
|
229
|
+
"Couldn't find this image to check its width: #{image_path}. \
|
230
|
+
Try to run Jekyll build a second time."
|
231
|
+
)
|
232
|
+
fallback_url = image_url
|
256
233
|
end
|
257
234
|
|
258
235
|
srcset = []
|
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.
|
4
|
+
version: 1.8.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: 2017-
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '4.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: fastimage
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|