vips-thumbnail 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -26
- data/Gemfile +0 -8
- data/README.md +4 -4
- data/lib/vips/thumbnail/resizer.rb +12 -5
- data/lib/vips/thumbnail/version.rb +1 -1
- data/vips-thumbnail.gemspec +3 -2
- metadata +23 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 327289b66b4aace5068260580d1a4f313deb9d44844f548a580f271e2a6aaa57
|
4
|
+
data.tar.gz: 108b8ed949461dfcfc065bd3bd3a2d9004eb5222a24e17ef099b3b6c6ad7f8fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58d7ed1a47a3b19325302293cf330e686a2f6b6b9ac32cc6c0b228616c8c777f3f5b44de879cabd0542fdfcb317ff1fc3646310841488daebf5032f315039bc8
|
7
|
+
data.tar.gz: 3ebdd3f76e93a11bcb8763b70b662e585aec1ca05a176c5a9bd0d43a640136d5e07d16260c21d75af23365cd30fb4b6e41e1328105a147031dbf2405120467e1
|
data/.travis.yml
CHANGED
@@ -1,29 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
sudo: false
|
6
|
-
dist: trusty
|
7
|
-
|
8
|
-
cache:
|
9
|
-
- bundler
|
10
|
-
|
11
|
-
before_script:
|
12
|
-
- gem update --system
|
13
|
-
- gem install bundler
|
14
|
-
|
15
|
-
rvm:
|
16
|
-
- 2.3
|
17
|
-
- 2.4
|
18
|
-
- 2.5
|
19
|
-
- 2.6
|
20
|
-
- ruby-head
|
21
|
-
- rbx-2
|
22
|
-
|
23
|
-
env:
|
24
|
-
- COVERAGE=true
|
1
|
+
language: ruby
|
2
|
+
dist: xenial
|
3
|
+
cache: bundler
|
25
4
|
|
26
5
|
matrix:
|
6
|
+
include:
|
7
|
+
- rvm: 2.4
|
8
|
+
- rvm: 2.5
|
9
|
+
- rvm: 2.6
|
10
|
+
- rvm: 2.6
|
11
|
+
env: COVERAGE=PartialSummary,Coveralls
|
12
|
+
- rvm: 2.7
|
13
|
+
- rvm: truffleruby
|
14
|
+
- rvm: jruby
|
15
|
+
- rvm: ruby-head
|
27
16
|
allow_failures:
|
28
|
-
|
29
|
-
|
17
|
+
- rvm: truffleruby
|
18
|
+
- rvm: ruby-head
|
19
|
+
- rvm: jruby-head
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
An easy to use thumbnail resizer. It's based on libvips so it's [faster than everything else](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use).
|
4
4
|
|
5
|
-
[![Build Status](https://
|
5
|
+
[![Build Status](https://travis-ci.com/ioquatix/vips-thumbnail.svg)](https://travis-ci.com/ioquatix/vips-thumbnail)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/ioquatix/vips-thumbnail.svg)](https://codeclimate.com/github/ioquatix/vips-thumbnail)
|
7
7
|
[![Coverage Status](https://coveralls.io/repos/ioquatix/vips-thumbnail/badge.svg)](https://coveralls.io/r/ioquatix/vips-thumbnail)
|
8
8
|
|
@@ -33,10 +33,10 @@ It's super easy:
|
|
33
33
|
```ruby
|
34
34
|
resizer = Vips::Thumbnail::Resizer.new(input_path)
|
35
35
|
if image = resizer.resize_to_fit([800, 600])
|
36
|
-
|
36
|
+
image.write_to_file(output_path)
|
37
37
|
else
|
38
|
-
|
39
|
-
|
38
|
+
# The source image wasn't big enough:
|
39
|
+
symlink(input_path, output_path)
|
40
40
|
end
|
41
41
|
```
|
42
42
|
|
@@ -25,12 +25,9 @@ module Vips
|
|
25
25
|
class Resizer
|
26
26
|
def initialize(input_path = nil, **options, &block)
|
27
27
|
@input_path = input_path
|
28
|
+
@options = options
|
28
29
|
|
29
|
-
@block = block ||
|
30
|
-
Vips::Image.new_from_file(@input_path, **options).tap do |image|
|
31
|
-
image.autorot if image.respond_to?(:autorot)
|
32
|
-
end
|
33
|
-
end
|
30
|
+
@block = block || self.method(:load)
|
34
31
|
|
35
32
|
@input_image = nil
|
36
33
|
end
|
@@ -78,6 +75,16 @@ module Vips
|
|
78
75
|
|
79
76
|
private
|
80
77
|
|
78
|
+
def load
|
79
|
+
image = Vips::Image.new_from_file(@input_path, **@options)
|
80
|
+
|
81
|
+
if image.respond_to?(:autorot)
|
82
|
+
image = image.autorot
|
83
|
+
end
|
84
|
+
|
85
|
+
return image
|
86
|
+
end
|
87
|
+
|
81
88
|
def fit(image, width, height)
|
82
89
|
x_scale = Rational(width, image.width)
|
83
90
|
y_scale = Rational(height, image.height)
|
data/vips-thumbnail.gemspec
CHANGED
@@ -16,9 +16,10 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency "vips", "~> 8.
|
19
|
+
spec.add_dependency "vips", "~> 8.8"
|
20
20
|
|
21
|
-
spec.add_development_dependency "
|
21
|
+
spec.add_development_dependency "covered"
|
22
|
+
spec.add_development_dependency "bundler"
|
22
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vips-thumbnail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vips
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '8.
|
19
|
+
version: '8.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '8.
|
26
|
+
version: '8.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: covered
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
115
|
- !ruby/object:Gem::Version
|
102
116
|
version: '0'
|
103
117
|
requirements: []
|
104
|
-
|
105
|
-
rubygems_version: 2.7.6
|
118
|
+
rubygems_version: 3.0.6
|
106
119
|
signing_key:
|
107
120
|
specification_version: 4
|
108
121
|
summary: Convenient thumbnail resizing using libvips.
|