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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8aaeed177d571388aaee458474e013b9c99f0965bc48bd1a22d4041a1dcef38d
4
- data.tar.gz: 475e6843df583c9dc11c5742fa5cf9afc12ca22f171ba99fc2b7d04d069a7847
3
+ metadata.gz: 9343975c53eefd5a9e88ed8ef249455a5fc82ca6ae5ba5b36ce46f369ee0d24b
4
+ data.tar.gz: 2ab5924b0216ff9354bb404316f43b09448431d04fcfe9ae5233ca4da347f8a8
5
5
  SHA512:
6
- metadata.gz: 8ce335efa57aa6d2f82f0fef851ae192a748c9e2245d87187da6f598ec0add082be44a9fb5594d5f8f4675b3505f9f562aa606d52ea1cb397e3af8fd85e6953c
7
- data.tar.gz: 717f5b7681bafb34f86bff82845b776281640d6c79b12d83c1d43f9b85ff5fbdeaf5c80f182c6c7221afa8f3154775d105fef21b34c2eb766c80710c200ccc39
6
+ metadata.gz: 52d5e60cc1edfb8e5a72dcbdbfaf062d51846fe0a281103ece714fc5251ee75d9c3f9c19ee3ac7e137c147f8a9a56b3c79fde6df28488f353923cc0b623f96a1
7
+ data.tar.gz: fccc5454c030535ace052d299c4f34b419d6d698aa3ff24fd3447adc52414118bb144204bdccf7ce04dd89f00b13be1200f8d3e823e20b9579ac9b1cef8d93ef
@@ -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
- def image
21
- @image ||= Vips::Image.new_from_file filename, access: :sequential
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: image, **args
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
- @thumbnail ||= Vips::Image.thumbnail filename,
26
- width,
27
- height: height,
28
- auto_rotate: auto_rotate,
29
- crop: crop
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.6.1
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-20 00:00:00.000000000 Z
11
+ date: 2020-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll