paperclip-vips 1.2.1 → 1.2.2
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/paperclip-vips/paperclip/vips.rb +22 -5
- data/lib/paperclip-vips/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ae2f6d67f0b4f56d5fe0a24af01b01c424d54a16ddc0b9e7d0b8abef95e3bfe
|
4
|
+
data.tar.gz: 8db36f72a48bea6b6e071fb65daf65112a67d5bf46d641f45c9bb2538a25aa82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9b022534d9463681394514795cc6966d85798c0c28da2fae5dc4f7f9f2d3d8ab6341c6f99fcd80c745413b7e85edf39105b45819e271b375420d32b4d4c388
|
7
|
+
data.tar.gz: 0d282b14f4ca78798509ef4ddfee89803cca46647e99c0c893879b4ae66a8603adb565d3557c64657d773a0374ea1dd3205dab73c54a22b364492bcf26f9f35d
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Paperclip
|
2
2
|
class Vips < Processor
|
3
|
-
attr_accessor :
|
4
|
-
:
|
3
|
+
attr_accessor :auto_orient, :convert_options, :current_geometry, :format, :source_file_options,
|
4
|
+
:target_geometry, :whiny
|
5
5
|
|
6
6
|
def initialize(file, options = {}, attachment = nil)
|
7
7
|
super
|
@@ -11,7 +11,10 @@ module Paperclip
|
|
11
11
|
@target_geometry = options.fetch(:string_geometry_parser, Geometry).parse(geometry)
|
12
12
|
@current_geometry = options.fetch(:file_geometry_parser, Geometry).from_file(@file)
|
13
13
|
@whiny = options.fetch(:whiny, true)
|
14
|
-
|
14
|
+
|
15
|
+
@auto_orient = options.fetch(:auto_orient, true)
|
16
|
+
@convert_options = options[:convert_options]
|
17
|
+
|
15
18
|
@current_format = current_format(file).downcase
|
16
19
|
@format = options[:format] || @current_format
|
17
20
|
|
@@ -67,8 +70,8 @@ module Paperclip
|
|
67
70
|
end
|
68
71
|
|
69
72
|
def process_convert_options(image)
|
70
|
-
if image
|
71
|
-
commands =
|
73
|
+
if image
|
74
|
+
commands = parsed_convert_commands(@convert_options)
|
72
75
|
commands.each do |cmd|
|
73
76
|
image = ::Vips::Operation.call(cmd[:cmd], [image, *cmd[:args]], cmd[:optional] || {})
|
74
77
|
end
|
@@ -77,6 +80,20 @@ module Paperclip
|
|
77
80
|
return image
|
78
81
|
end
|
79
82
|
|
83
|
+
def parsed_convert_commands(convert_options)
|
84
|
+
begin
|
85
|
+
commands = JSON.parse(convert_options, symbolize_names: true)
|
86
|
+
rescue
|
87
|
+
commands = []
|
88
|
+
end
|
89
|
+
|
90
|
+
if @auto_orient && commands.exclude?({ cmd: "autorot" })
|
91
|
+
commands.unshift({ cmd: "autorot" })
|
92
|
+
end
|
93
|
+
|
94
|
+
return commands
|
95
|
+
end
|
96
|
+
|
80
97
|
def save_thumbnail(thumbnail, path)
|
81
98
|
case @current_format
|
82
99
|
when ".jpeg", ".jpg"
|
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.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Greeff
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paperclip
|