vips-thumbnail 1.4.1 → 1.6.1

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
  SHA256:
3
- metadata.gz: 5fcda2da8b14ba9d7765753fcf32a3f8d8f501d0ce1cbee6f6f4dd9b63a598d7
4
- data.tar.gz: 179cba358e859732159f46b6166c533fddd1c4e0a99843fe88c41b6dc6809c61
3
+ metadata.gz: 21d0a15a71b5687f26d6daed21e8b6b18bb0149b86513128470c98d00be6296d
4
+ data.tar.gz: a0164f21031eb214bcc07b6c9ec0c179233a35a6652d7f9710327417f588a9b0
5
5
  SHA512:
6
- metadata.gz: af6b20b12bf0de53fe28dd275831f073a897681a56e136def93882c777afe99f18186e8e32957f96db16a89fecbc595102d714c2740ad611ead3cdb8f1a3e651
7
- data.tar.gz: '085d914937548d72b795939e75d06aa7297321535f9df56596b79297c218907613811ccec625b37720e7352df6e32e20e7f155131e79e8e08f07e4c76c561af4'
6
+ metadata.gz: 3fd455a2424f8d9f8f34ff7df4041848cc410bf68801a163be91c4a0b305b2b6570d48d128e7a16beb0122cef3c1f815add5f47a4eef3fec5b336dc70e442bfc
7
+ data.tar.gz: db75943352ad7b14cf915ebd56399c93c7e7bfece24c54384cad865faeb153cf4347c3b564baa30cdfa4b01fe31925009ac5c25dbc37b9a48ada2a5c71ac516a
checksums.yaml.gz.sig ADDED
Binary file
@@ -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 || lambda do
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
@@ -38,10 +35,13 @@ module Vips
38
35
  attr :input_path
39
36
  attr :options
40
37
 
41
- def flush!
38
+ def close
39
+ @input_image&.close
42
40
  @input_image = nil
43
41
  end
44
42
 
43
+ alias flush! close
44
+
45
45
  def input_image
46
46
  unless @input_image
47
47
  @input_image = @block.call
@@ -78,6 +78,16 @@ module Vips
78
78
 
79
79
  private
80
80
 
81
+ def load
82
+ image = Vips::Image.new_from_file(@input_path, **@options)
83
+
84
+ if image.respond_to?(:autorot)
85
+ image = image.autorot
86
+ end
87
+
88
+ return image
89
+ end
90
+
81
91
  def fit(image, width, height)
82
92
  x_scale = Rational(width, image.width)
83
93
  y_scale = Rational(height, image.height)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Vips
22
22
  module Thumbnail
23
- VERSION = "1.4.1"
23
+ VERSION = "1.6.1"
24
24
  end
25
25
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vips-thumbnail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2018-06-16 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
14
+ ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
15
+ MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
16
+ aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
17
+ AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
18
+ xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
19
+ eNMDgKsMJtC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ETQYOd6b4e4Ag6
35
+ y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
36
+ RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
37
+ HiLJ8VOFx6w=
38
+ -----END CERTIFICATE-----
39
+ date: 2022-06-24 00:00:00.000000000 Z
12
40
  dependencies:
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: vips
@@ -16,42 +44,42 @@ dependencies:
16
44
  requirements:
17
45
  - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: '8.6'
47
+ version: '8.9'
20
48
  type: :runtime
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '8.6'
54
+ version: '8.9'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: bundler
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - "~>"
59
+ - - ">="
32
60
  - !ruby/object:Gem::Version
33
- version: '1.14'
61
+ version: '0'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - "~>"
66
+ - - ">="
39
67
  - !ruby/object:Gem::Version
40
- version: '1.14'
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
- name: rake
70
+ name: covered
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - "~>"
73
+ - - ">="
46
74
  - !ruby/object:Gem::Version
47
- version: '10.0'
75
+ version: '0'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - "~>"
80
+ - - ">="
53
81
  - !ruby/object:Gem::Version
54
- version: '10.0'
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rspec
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -66,27 +94,21 @@ dependencies:
66
94
  - - "~>"
67
95
  - !ruby/object:Gem::Version
68
96
  version: '3.0'
69
- description:
97
+ description:
70
98
  email:
71
- - samuel.williams@oriontransfer.co.nz
72
99
  executables: []
73
100
  extensions: []
74
101
  extra_rdoc_files: []
75
102
  files:
76
- - ".gitignore"
77
- - ".rspec"
78
- - ".travis.yml"
79
- - Gemfile
80
- - README.md
81
- - Rakefile
82
103
  - lib/vips/thumbnail.rb
83
104
  - lib/vips/thumbnail/resizer.rb
84
105
  - lib/vips/thumbnail/version.rb
85
- - vips-thumbnail.gemspec
86
106
  homepage: https://github.com/ioquatix/vips-thumbnail
87
- licenses: []
88
- metadata: {}
89
- post_install_message:
107
+ licenses:
108
+ - MIT
109
+ metadata:
110
+ funding_uri: https://github.com/sponsors/ioquatix/
111
+ post_install_message:
90
112
  rdoc_options: []
91
113
  require_paths:
92
114
  - lib
@@ -101,9 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
123
  - !ruby/object:Gem::Version
102
124
  version: '0'
103
125
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.7.6
106
- signing_key:
126
+ rubygems_version: 3.3.7
127
+ signing_key:
107
128
  specification_version: 4
108
129
  summary: Convenient thumbnail resizing using libvips.
109
130
  test_files: []
metadata.gz.sig ADDED
Binary file
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/.rspec DELETED
@@ -1,5 +0,0 @@
1
- --color
2
- --format documentation
3
- --backtrace
4
- --warnings
5
- --require spec_helper
data/.travis.yml DELETED
@@ -1,29 +0,0 @@
1
- os:
2
- - linux
3
- # - osx
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
25
-
26
- matrix:
27
- allow_failures:
28
- - rvm: "rbx-2"
29
- - rvm: "ruby-head"
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in vips-thumbnail.gemspec
4
- gemspec
5
-
6
- group :development do
7
- end
8
-
9
- group :test do
10
- gem 'simplecov'
11
- gem 'coveralls', require: false
12
- end
data/README.md DELETED
@@ -1,75 +0,0 @@
1
- # Vips::Thumbnail
2
-
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
-
5
- [![Build Status](https://secure.travis-ci.org/ioquatix/vips-thumbnail.svg)](http://travis-ci.org/ioquatix/vips-thumbnail)
6
- [![Code Climate](https://codeclimate.com/github/ioquatix/vips-thumbnail.svg)](https://codeclimate.com/github/ioquatix/vips-thumbnail)
7
- [![Coverage Status](https://coveralls.io/repos/ioquatix/vips-thumbnail/badge.svg)](https://coveralls.io/r/ioquatix/vips-thumbnail)
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'vips-thumbnail'
15
- ```
16
-
17
- And then execute:
18
-
19
- $ bundle
20
-
21
- Or install it yourself as:
22
-
23
- $ gem install vips-thumbnail
24
-
25
- ### Minimum Version
26
-
27
- `libvips` has some [integer truncation issues](https://github.com/jcupitt/ruby-vips/issues/82) in versions < 8.4, so you *must* use a release >= 8.4 otherwise you may experience problems with `resize_to_fill`.
28
-
29
- ## Usage
30
-
31
- It's super easy:
32
-
33
- ```ruby
34
- resizer = Vips::Thumbnail::Resizer.new(input_path)
35
- if image = resizer.resize_to_fit([800, 600])
36
- image.write_to_file(output_path)
37
- else
38
- # The source image wasn't big enough:
39
- symlink(input_path, output_path)
40
- end
41
- ```
42
-
43
- There are two main methods, `#resize_to_fit` which preserves aspect ratio, and `#resize_to_fill` which resizes and crops to fit the desired size if needed.
44
-
45
- ## Contributing
46
-
47
- 1. Fork it
48
- 2. Create your feature branch (`git checkout -b my-new-feature`)
49
- 3. Commit your changes (`git commit -am 'Add some feature'`)
50
- 4. Push to the branch (`git push origin my-new-feature`)
51
- 5. Create new Pull Request
52
-
53
- ## License
54
-
55
- Released under the MIT license.
56
-
57
- Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
58
-
59
- Permission is hereby granted, free of charge, to any person obtaining a copy
60
- of this software and associated documentation files (the "Software"), to deal
61
- in the Software without restriction, including without limitation the rights
62
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63
- copies of the Software, and to permit persons to whom the Software is
64
- furnished to do so, subject to the following conditions:
65
-
66
- The above copyright notice and this permission notice shall be included in
67
- all copies or substantial portions of the Software.
68
-
69
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
70
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
71
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
72
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
73
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
74
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
75
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
- require_relative 'lib/vips/thumbnail/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "vips-thumbnail"
6
- spec.version = Vips::Thumbnail::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = %q{Convenient thumbnail resizing using libvips.}
11
- spec.homepage = "https://github.com/ioquatix/vips-thumbnail"
12
-
13
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
- f.match(%r{^(test|spec|features)/})
15
- end
16
-
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_dependency "vips", "~> 8.6"
20
-
21
- spec.add_development_dependency "bundler", "~> 1.14"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_development_dependency "rspec", "~> 3.0"
24
- end