jekyll-images 0.2.2 → 0.2.3

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: ae6326d21281e0a11c937c7cd9399804b514330097c030e13d4afde55abe168d
4
- data.tar.gz: ce83123dfc3be33db70d6f310deb9f25d859b3d6efb19059149ead1182b93fcc
3
+ metadata.gz: 522e86cd58354de44d3f57ec228fccdb3a2b2872f409f0ba2c7c7602faebf885
4
+ data.tar.gz: 4839dba88514687693ecc6ca174764f9c9b3dceecb6899e00e3d40383f9ffcb9
5
5
  SHA512:
6
- metadata.gz: c041e5a823e8cedcc6f792696c24bead1a33a8d57102eabec3fa01b4ffd2dee90a1598225bf0c6bce215a12419d5f62fbdb76e2f0e8ffde11aed393e50cd34ff
7
- data.tar.gz: d8af52b5b829e774e5e3eec70b87c9229a7803eb02b4c688847792608580d4010e185fbe59beceff9401408a0ccdbe0f88958c53bdf04dbd34365ba29fbe71a1
6
+ metadata.gz: 644c96a927fabe9d74aebcc67a936d26a45302413f1ce63b7e704124c5de6d30820fa951518ce6dc62de069393e62765df8be07b0f2c8d75b4ed06c9e885b4b2
7
+ data.tar.gz: 324147f91123e3217079b6b9856e9e855852e285a9c4c3e83893488c0ad54f6a42d3dbbb826968e58dd5d1b578b99c79424f93a1917c400984cbe7bb96fe3f5b
@@ -8,7 +8,7 @@ module Jekyll
8
8
  #
9
9
  # We're assuming every image is going to be thumbnailed
10
10
  class Thumbnail
11
- attr_reader :site, :image, :thumbnail, :filename, :width, :height
11
+ attr_reader :site, :filename, :width, :height, :crop, :auto_rotate
12
12
 
13
13
  def initialize(site, filename, **args)
14
14
  unless File.exist? filename
@@ -20,16 +20,29 @@ module Jekyll
20
20
  @filename = filename
21
21
  @width = args[:width]
22
22
  @height = args[:height]
23
- @image = Vips::Image.new_from_file filename, access: :sequential
24
- @thumbnail = image.thumbnail_image width,
25
- height: height || proportional_height,
26
- auto_rotate: args[:auto_rotate],
27
- crop: args[:crop].to_sym
23
+ @crop = args[:crop].to_sym
24
+ @auto_rotate = args[:auto_rotate]
28
25
  end
29
26
 
30
- # Finds a height that's proportional to the width
27
+ def image
28
+ @image ||= Vips::Image.new_from_file filename,
29
+ access: :sequential
30
+ end
31
+
32
+ def thumbnail
33
+ @thumbnail ||= image.thumbnail_image width,
34
+ height: height,
35
+ auto_rotate: auto_rotate,
36
+ crop: crop
37
+ end
38
+
39
+ def height
40
+ @height || proportional_height
41
+ end
42
+
43
+ # Finds a heigth that's proportional to the width
31
44
  def proportional_height
32
- @height = (image.height * (width / image.width.to_f)).round
45
+ @proportional_height ||= (image.height * (width / image.width.to_f)).round
33
46
  end
34
47
 
35
48
  # Generates a destination from filename only if we're downsizing
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Images
5
- VERSION = '0.2.2'
5
+ VERSION = '0.2.3'
6
6
  end
7
7
  end
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-07 00:00:00.000000000 Z
11
+ date: 2020-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-vips