paperclip-vips 1.0.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +44 -36
- data/lib/paperclip-vips/paperclip/vips.rb +53 -42
- data/lib/paperclip-vips/version.rb +1 -1
- data/paperclip-vips.gemspec +4 -3
- metadata +29 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ee434152fdb78f28ebf9c7c284947f5f1ead3341b419b518f3ba546f4c32578
|
4
|
+
data.tar.gz: 72a3e1263f7c165ec096cec5111bab762693992507bc769678cd5f1ad7a0e42e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c505d092254d9dc6ad9170cf7fc1a1b6ed45302e9a6eb77feb7d7be2d1f8950688ea1d1aa86698f0dd392a59e29cb3cc52cf0b299ea0a861195934d2a9daa60
|
7
|
+
data.tar.gz: 3ee2067929f1bf42765f52c3e7986254cce4dbe52d83393f7a1743c5589a9854a08970fc12afafb88a50f05e89ba984719098d4455731fcb6356e272c23d3afd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## [1.2.1] - 2022-01-31
|
2
|
+
|
3
|
+
- Update dev dependencies
|
4
|
+
|
5
|
+
## [1.2.0] - 2022-01-31
|
6
|
+
|
7
|
+
- Update ruby-vips and dependencies
|
8
|
+
|
9
|
+
## [1.1.0] - 2019-06-06
|
10
|
+
|
11
|
+
- Check paperclip filename to get file format
|
12
|
+
|
13
|
+
## [1.0.0] - 2019-05-31
|
14
|
+
|
15
|
+
- Setup the initial project and base components.
|
data/Gemfile.lock
CHANGED
@@ -1,67 +1,75 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paperclip-vips (1.
|
5
|
-
paperclip (>= 5.
|
6
|
-
ruby-vips (~> 2.
|
4
|
+
paperclip-vips (1.2.1)
|
5
|
+
paperclip (>= 5.0.0)
|
6
|
+
ruby-vips (~> 2.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
activesupport (
|
11
|
+
activemodel (6.1.4.4)
|
12
|
+
activesupport (= 6.1.4.4)
|
13
|
+
activesupport (6.1.4.4)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>=
|
16
|
-
minitest (
|
17
|
-
tzinfo (~>
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
zeitwerk (~> 2.3)
|
19
|
+
byebug (11.1.3)
|
18
20
|
climate_control (0.2.0)
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
diff-lcs (1.
|
21
|
-
ffi (1.
|
22
|
-
i18n (1.
|
21
|
+
concurrent-ruby (1.1.9)
|
22
|
+
diff-lcs (1.5.0)
|
23
|
+
ffi (1.15.5)
|
24
|
+
i18n (1.9.1)
|
23
25
|
concurrent-ruby (~> 1.0)
|
24
|
-
mime-types (3.
|
26
|
+
mime-types (3.4.1)
|
25
27
|
mime-types-data (~> 3.2015)
|
26
|
-
mime-types-data (3.
|
27
|
-
mimemagic (0.3.
|
28
|
-
|
28
|
+
mime-types-data (3.2022.0105)
|
29
|
+
mimemagic (0.3.10)
|
30
|
+
nokogiri (~> 1)
|
31
|
+
rake
|
32
|
+
minitest (5.15.0)
|
33
|
+
nokogiri (1.12.5)
|
34
|
+
racc (~> 1.4)
|
29
35
|
paperclip (6.1.0)
|
30
36
|
activemodel (>= 4.2.0)
|
31
37
|
activesupport (>= 4.2.0)
|
32
38
|
mime-types
|
33
39
|
mimemagic (~> 0.3.0)
|
34
40
|
terrapin (~> 0.6.0)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
rspec-
|
39
|
-
rspec-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
racc (1.6.0)
|
42
|
+
rake (13.0.6)
|
43
|
+
rspec (3.10.0)
|
44
|
+
rspec-core (~> 3.10.0)
|
45
|
+
rspec-expectations (~> 3.10.0)
|
46
|
+
rspec-mocks (~> 3.10.0)
|
47
|
+
rspec-core (3.10.2)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.2)
|
43
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-mocks (3.
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-mocks (3.10.3)
|
46
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-support (3.
|
49
|
-
ruby-vips (2.
|
50
|
-
ffi (~> 1.
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.3)
|
56
|
+
ruby-vips (2.1.4)
|
57
|
+
ffi (~> 1.12)
|
51
58
|
terrapin (0.6.0)
|
52
59
|
climate_control (>= 0.0.3, < 1.0)
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
tzinfo (2.0.4)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
zeitwerk (2.5.4)
|
56
63
|
|
57
64
|
PLATFORMS
|
58
65
|
ruby
|
59
66
|
|
60
67
|
DEPENDENCIES
|
61
68
|
bundler (~> 2.0)
|
69
|
+
byebug (~> 11.0)
|
62
70
|
paperclip-vips!
|
63
|
-
rake (~>
|
71
|
+
rake (~> 13.0)
|
64
72
|
rspec (~> 3.0)
|
65
73
|
|
66
74
|
BUNDLED WITH
|
67
|
-
2.0.
|
75
|
+
2.0.2
|
@@ -12,20 +12,12 @@ module Paperclip
|
|
12
12
|
@current_geometry = options.fetch(:file_geometry_parser, Geometry).from_file(@file)
|
13
13
|
@whiny = options.fetch(:whiny, true)
|
14
14
|
|
15
|
-
@current_format =
|
15
|
+
@current_format = current_format(file).downcase
|
16
16
|
@format = options[:format] || @current_format
|
17
17
|
|
18
18
|
@basename = File.basename(@file.path, @current_format)
|
19
19
|
end
|
20
20
|
|
21
|
-
def crop
|
22
|
-
if @should_crop
|
23
|
-
return @options[:crop] || :centre
|
24
|
-
end
|
25
|
-
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
|
29
21
|
def make
|
30
22
|
source = @file
|
31
23
|
filename = [@basename, @format ? ".#{@format}" : ""].join
|
@@ -47,46 +39,65 @@ module Paperclip
|
|
47
39
|
return destination
|
48
40
|
end
|
49
41
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
def height
|
55
|
-
@target_geometry&.height || @current_geometry.height
|
56
|
-
end
|
57
|
-
|
58
|
-
def process_convert_options(image)
|
59
|
-
if image && @options[:convert_options].present?
|
60
|
-
commands = JSON.parse(@options[:convert_options], symbolize_names: true)
|
61
|
-
commands.each do |cmd|
|
62
|
-
image = ::Vips::Operation.call(cmd[:cmd], [image, *cmd[:args]], cmd[:optional] || {})
|
42
|
+
private
|
43
|
+
def crop
|
44
|
+
if @should_crop
|
45
|
+
return @options[:crop] || :centre
|
63
46
|
end
|
47
|
+
|
48
|
+
nil
|
64
49
|
end
|
65
50
|
|
66
|
-
|
67
|
-
|
51
|
+
def current_format(file)
|
52
|
+
extension = File.extname(file.path)
|
53
|
+
return extension if extension.present?
|
68
54
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
when ".gif"
|
74
|
-
save_gif(thumbnail, path)
|
75
|
-
when ".png"
|
76
|
-
save_png(thumbnail, path)
|
55
|
+
extension = File.extname(file.original_filename)
|
56
|
+
return extension if extension.present?
|
57
|
+
|
58
|
+
return ""
|
77
59
|
end
|
78
|
-
end
|
79
60
|
|
80
|
-
|
81
|
-
|
82
|
-
|
61
|
+
def width
|
62
|
+
@target_geometry&.width || @current_geometry.width
|
63
|
+
end
|
83
64
|
|
84
|
-
|
85
|
-
|
86
|
-
|
65
|
+
def height
|
66
|
+
@target_geometry&.height || @current_geometry.height
|
67
|
+
end
|
68
|
+
|
69
|
+
def process_convert_options(image)
|
70
|
+
if image && @options[:convert_options].present?
|
71
|
+
commands = JSON.parse(@options[:convert_options], symbolize_names: true)
|
72
|
+
commands.each do |cmd|
|
73
|
+
image = ::Vips::Operation.call(cmd[:cmd], [image, *cmd[:args]], cmd[:optional] || {})
|
74
|
+
end
|
75
|
+
end
|
87
76
|
|
88
|
-
|
89
|
-
|
90
|
-
|
77
|
+
return image
|
78
|
+
end
|
79
|
+
|
80
|
+
def save_thumbnail(thumbnail, path)
|
81
|
+
case @current_format
|
82
|
+
when ".jpeg", ".jpg"
|
83
|
+
save_jpg(thumbnail, path)
|
84
|
+
when ".gif"
|
85
|
+
save_gif(thumbnail, path)
|
86
|
+
when ".png"
|
87
|
+
save_png(thumbnail, path)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def save_jpg(thumbnail, path)
|
92
|
+
thumbnail.jpegsave(path)
|
93
|
+
end
|
94
|
+
|
95
|
+
def save_gif(thumbnail, path)
|
96
|
+
thumbnail.magicksave(path)
|
97
|
+
end
|
98
|
+
|
99
|
+
def save_png(thumbnail, path)
|
100
|
+
thumbnail.pngsave(path)
|
101
|
+
end
|
91
102
|
end
|
92
103
|
end
|
data/paperclip-vips.gemspec
CHANGED
@@ -22,10 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'paperclip',
|
26
|
-
spec.add_runtime_dependency "ruby-vips", "~> 2.
|
25
|
+
spec.add_runtime_dependency 'paperclip', ">= 5.0.0"
|
26
|
+
spec.add_runtime_dependency "ruby-vips", "~> 2.1"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 2.0"
|
29
|
-
spec.add_development_dependency "rake", "~>
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
spec.add_development_dependency "byebug", "~> 11.0"
|
31
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-vips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Greeff
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paperclip
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: 5.0.0
|
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: 5.
|
26
|
+
version: 5.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-vips
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,21 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '11.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '11.0'
|
97
|
+
description:
|
84
98
|
email:
|
85
99
|
- ken@kengreeff.com
|
86
100
|
executables: []
|
@@ -90,6 +104,7 @@ files:
|
|
90
104
|
- ".gitignore"
|
91
105
|
- ".rspec"
|
92
106
|
- ".travis.yml"
|
107
|
+
- CHANGELOG.md
|
93
108
|
- CODE_OF_CONDUCT.md
|
94
109
|
- Gemfile
|
95
110
|
- Gemfile.lock
|
@@ -106,7 +121,7 @@ homepage: https://github.com/realhub/paperclip-vips
|
|
106
121
|
licenses:
|
107
122
|
- MIT
|
108
123
|
metadata: {}
|
109
|
-
post_install_message:
|
124
|
+
post_install_message:
|
110
125
|
rdoc_options: []
|
111
126
|
require_paths:
|
112
127
|
- lib
|
@@ -121,9 +136,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
136
|
- !ruby/object:Gem::Version
|
122
137
|
version: '0'
|
123
138
|
requirements: []
|
124
|
-
rubyforge_project:
|
125
|
-
rubygems_version: 2.7.
|
126
|
-
signing_key:
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.7.10
|
141
|
+
signing_key:
|
127
142
|
specification_version: 4
|
128
143
|
summary: Uses Ruby Vips to when creating thumbnails for faster generation.
|
129
144
|
test_files: []
|