tinyimg 0.1.3 → 0.1.4
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/Gemfile.lock +2 -2
- data/ext/tinyimg/tinyimg.c +8 -2
- data/lib/tinyimg.rb +2 -2
- data/tinyimg.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c78967e8d009c48624f294022767f9ae638aac1
|
4
|
+
data.tar.gz: ad732e2833692887729f60ce0bcf1f7c8f29ef02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4417c46de9733d20b4091408e815c13eafccd55ce4e14519c65aacf9ea269c8a010993f3a83559448b1185674aff87bc4bca9cfab1c80bdc498063a0baa1c464
|
7
|
+
data.tar.gz: 81bd7334ef275c6f31ac5d0b2c50a478d71255f0495066d428973ff075b6a52c688798b7c4904981948e444469b2fd3be41c13392e949352860bd6674a01e0c0
|
data/Gemfile.lock
CHANGED
data/ext/tinyimg/tinyimg.c
CHANGED
@@ -45,16 +45,22 @@ VALUE load_from_string(VALUE self, VALUE input, VALUE type)
|
|
45
45
|
{
|
46
46
|
gdImagePtr image;
|
47
47
|
ID type_id;
|
48
|
+
long input_length;
|
48
49
|
|
49
50
|
Check_Type(input, T_STRING);
|
50
51
|
Check_Type(type, T_SYMBOL);
|
51
52
|
type_id = SYM2ID(type);
|
52
53
|
|
54
|
+
input_length = RSTRING_LEN(input);
|
55
|
+
if (input_length >= 1L << 31) {
|
56
|
+
rb_raise(get_error_class(self), "input must be less than 2GB in length");
|
57
|
+
}
|
58
|
+
|
53
59
|
if (type_id == rb_intern("png")) {
|
54
|
-
image = gdImageCreateFromPngPtr(
|
60
|
+
image = gdImageCreateFromPngPtr((int)input_length, RSTRING_PTR(input));
|
55
61
|
}
|
56
62
|
else if (type_id == rb_intern("jpeg")) {
|
57
|
-
image = gdImageCreateFromJpegPtr(
|
63
|
+
image = gdImageCreateFromJpegPtr((int)input_length, RSTRING_PTR(input));
|
58
64
|
}
|
59
65
|
else {
|
60
66
|
rb_raise(get_error_class(self), "type must be a supported image type");
|
data/lib/tinyimg.rb
CHANGED
@@ -27,7 +27,7 @@ class Tinyimg
|
|
27
27
|
|
28
28
|
def resize!(*args)
|
29
29
|
case args.map(&:class)
|
30
|
-
when [
|
30
|
+
when [Integer, Integer]
|
31
31
|
resize_exact!(*args)
|
32
32
|
when [Hash]
|
33
33
|
width, height = convert_hash_to_exact_dimensions(args.first)
|
@@ -164,7 +164,7 @@ class Tinyimg
|
|
164
164
|
raise Error, "expected either :width or :height or both keys"
|
165
165
|
end
|
166
166
|
|
167
|
-
if opts.values.any? { |v| !v.is_a?(
|
167
|
+
if opts.values.any? { |v| !v.is_a?(Integer) }
|
168
168
|
raise Error, ":width and :height values must be integers"
|
169
169
|
end
|
170
170
|
|
data/tinyimg.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'tinyimg'
|
3
|
-
gem.version = '0.1.
|
3
|
+
gem.version = '0.1.4'
|
4
4
|
gem.summary = "Tiny and fast JPEG/PNG cropping and resizing"
|
5
5
|
gem.description = "Convert between JPEG/PNG, crop and resize images, either all in memory or via disk. Only requires libgd to function."
|
6
6
|
gem.has_rdoc = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinyimg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.6.8
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Tiny and fast JPEG/PNG cropping and resizing
|