vips-thumbnail 1.0.1 → 1.0.2

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: 1e5df416590d90a76c603ec1552c1bd3505ed428
4
- data.tar.gz: 2bd71952ab956467c481434a400fa6012441a7f5
3
+ metadata.gz: ed23c230e313d3d7dc8e26e6c9c12b471743fa27
4
+ data.tar.gz: ad61217ca5757f059b1d8b49add28c2ea094da05
5
5
  SHA512:
6
- metadata.gz: ca4fee62063b6a361b8ade7668d4594d22d19c5e30b99eba047b53395317772d1fa371200be7cc5f080a294f571ad7974121f122172bdc549ed623abe29cccdc
7
- data.tar.gz: 52475f522e4af56807ec7839d5c871e1f89de84869122393b4c44724bf1910d76955996c746d7e8411153e17600f1f8290be9b969ec7a455621c0cc0aa50a8ca
6
+ metadata.gz: bd82792527b7b049c500f2df450268cce9d74faf76769fcd4672dde19e38b3b064a77860e78d42b80d6a9e714085ac04e73e16608064f19a6574a6b1d370724e
7
+ data.tar.gz: 7d2c01acee8193c53de1ae6bfb177c626d40b92e7f31a0d4fd7bb489d7e9084b5ce64e30929c3e44fcc4f2b8f0ca4cf1a84bd50db331af599e6f089f6d969ba8
@@ -93,18 +93,20 @@ module Vips
93
93
  height = image.height if y_scale > 1.0
94
94
  end
95
95
 
96
- return crop(image, width, height)
97
- end
98
-
99
- def crop(image, width, height)
96
+ # If you hit these errors, it means you are using an older version of vips (< 8.4) which has an integer truncation bug.
97
+ # https://github.com/jcupitt/ruby-vips/issues/82
100
98
  if image.height < height
101
- throw ArgumentError.new("Scaled image was smaller than expected! Scaled height #{image.height} < #{height}.")
99
+ raise ArgumentError.new("Image resized smaller than crop! Scaled height #{image.height} < #{height}.")
102
100
  end
103
101
 
104
102
  if image.width < width
105
- throw ArgumentError.new("Scaled image was smaller than expected! Scaled width #{image.width} < #{width}.")
103
+ raise ArgumentError.new("Image resized smaller than crop! Scaled width #{image.width} < #{width}.")
106
104
  end
107
105
 
106
+ return crop(image, width, height)
107
+ end
108
+
109
+ def crop(image, width, height)
108
110
  left = (image.width - width) / 2.0
109
111
  top = (image.height - height) / 2.0
110
112
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Vips
22
22
  module Thumbnail
23
- VERSION = "1.0.1"
23
+ VERSION = "1.0.2"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vips-thumbnail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams