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 +4 -4
- data/lib/vips/thumbnail/resizer.rb +8 -6
- data/lib/vips/thumbnail/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed23c230e313d3d7dc8e26e6c9c12b471743fa27
|
4
|
+
data.tar.gz: ad61217ca5757f059b1d8b49add28c2ea094da05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
97
|
-
|
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
|
-
|
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
|
-
|
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
|
|