jekyll-images 0.2.6.1 → 0.2.7
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/images/image.rb +7 -5
- data/lib/jekyll/images/thumbnail.rb +7 -5
- 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: 9343975c53eefd5a9e88ed8ef249455a5fc82ca6ae5ba5b36ce46f369ee0d24b
|
4
|
+
data.tar.gz: 2ab5924b0216ff9354bb404316f43b09448431d04fcfe9ae5233ca4da347f8a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52d5e60cc1edfb8e5a72dcbdbfaf062d51846fe0a281103ece714fc5251ee75d9c3f9c19ee3ac7e137c147f8a9a56b3c79fde6df28488f353923cc0b623f96a1
|
7
|
+
data.tar.gz: fccc5454c030535ace052d299c4f34b419d6d698aa3ff24fd3447adc52414118bb144204bdccf7ce04dd89f00b13be1200f8d3e823e20b9579ac9b1cef8d93ef
|
data/lib/jekyll/images/image.rb
CHANGED
@@ -5,7 +5,7 @@ require 'vips'
|
|
5
5
|
module Jekyll
|
6
6
|
module Images
|
7
7
|
class Image
|
8
|
-
attr_reader :site, :filename
|
8
|
+
attr_reader :site, :filename, :height, :width
|
9
9
|
|
10
10
|
def initialize(site, filename)
|
11
11
|
unless File.exist? filename
|
@@ -15,14 +15,16 @@ module Jekyll
|
|
15
15
|
@cached_thumbnails = {}
|
16
16
|
@site = site
|
17
17
|
@filename = filename
|
18
|
-
end
|
19
18
|
|
20
|
-
|
21
|
-
|
19
|
+
# We only need the image to get height and width
|
20
|
+
image = Vips::Image.new_from_file filename, access: :sequential
|
21
|
+
|
22
|
+
@height = image.height
|
23
|
+
@width = image.width
|
22
24
|
end
|
23
25
|
|
24
26
|
def thumbnail(**args)
|
25
|
-
@cached_thumbnails[args.hash.to_s] ||= Thumbnail.new site: site, filename: filename, image:
|
27
|
+
@cached_thumbnails[args.hash.to_s] ||= Thumbnail.new site: site, filename: filename, image: self, **args
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -21,12 +21,14 @@ module Jekyll
|
|
21
21
|
@auto_rotate = args[:auto_rotate].nil? ? true : args[:auto_rotate]
|
22
22
|
end
|
23
23
|
|
24
|
+
# XXX: We don't memoize because we don't need the thumbnail in
|
25
|
+
# memory after it has been written.
|
24
26
|
def thumbnail
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
Vips::Image.thumbnail filename,
|
28
|
+
width,
|
29
|
+
height: height,
|
30
|
+
auto_rotate: auto_rotate,
|
31
|
+
crop: crop
|
30
32
|
end
|
31
33
|
|
32
34
|
# Finds a height that's proportional to the width
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|