mini_magick 4.9.3 → 4.9.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/lib/mini_magick/configuration.rb +40 -10
- data/lib/mini_magick/image.rb +6 -8
- data/lib/mini_magick/image/info.rb +1 -1
- data/lib/mini_magick/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ab4ce03957b9a0f941f9bd2c34a5dcab63faffac5143eb6e7c90d7d860b57c5
|
4
|
+
data.tar.gz: 7bd78f0c862f1ca72b34e3c6fc4d14297adfa9dd6bc36218a35ef68c235320b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16c4bfa3744a2bea117bff0118afcbf89fac2f3d9e92c5c8af2b095f6c1381c1d000bede5086ccffd72ecca8152845cde11a5ff762186bd90793ee5d83e03a77
|
7
|
+
data.tar.gz: fe593ad2a7bfd4b6f2d9892533fd5347046e7dfb6cfd8e3bc6049cb1ae7686f5af60c23f33254175bca4728a58bdeeab2b9bfb873ebd94c46f14e68e086f002f
|
@@ -11,16 +11,12 @@ module MiniMagick
|
|
11
11
|
# @return [Symbol] `:imagemagick`, `:imagemagick7`, or `:graphicsmagick`
|
12
12
|
#
|
13
13
|
attr_accessor :cli
|
14
|
-
# @private (for backwards compatibility)
|
15
|
-
attr_accessor :processor
|
16
14
|
|
17
15
|
##
|
18
16
|
# If you don't have the CLI tools in your PATH, you can set the path to the
|
19
17
|
# executables.
|
20
18
|
#
|
21
|
-
|
22
|
-
#
|
23
|
-
attr_accessor :cli_path
|
19
|
+
attr_writer :cli_path
|
24
20
|
# @private (for backwards compatibility)
|
25
21
|
attr_accessor :processor_path
|
26
22
|
|
@@ -43,12 +39,12 @@ module MiniMagick
|
|
43
39
|
#
|
44
40
|
attr_accessor :timeout
|
45
41
|
##
|
46
|
-
# When
|
42
|
+
# When get to `true`, it outputs each command to STDOUT in their shell
|
47
43
|
# version.
|
48
44
|
#
|
49
45
|
# @return [Boolean]
|
50
46
|
#
|
51
|
-
|
47
|
+
attr_reader :debug
|
52
48
|
##
|
53
49
|
# Logger for {#debug}, default is `MiniMagick::Logger.new(STDOUT)`, but
|
54
50
|
# you can override it, for example if you want the logs to be written to
|
@@ -119,12 +115,14 @@ module MiniMagick
|
|
119
115
|
imagemagick7: "magick",
|
120
116
|
}
|
121
117
|
|
118
|
+
# @private (for backwards compatibility)
|
122
119
|
def processor
|
123
120
|
@processor ||= CLI_DETECTION.values.detect do |processor|
|
124
121
|
MiniMagick::Utilities.which(processor)
|
125
122
|
end
|
126
123
|
end
|
127
124
|
|
125
|
+
# @private (for backwards compatibility)
|
128
126
|
def processor=(processor)
|
129
127
|
@processor = processor.to_s
|
130
128
|
|
@@ -135,11 +133,27 @@ module MiniMagick
|
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
136
|
+
##
|
137
|
+
# Get [ImageMagick](http://www.imagemagick.org) or
|
138
|
+
# [GraphicsMagick](http://www.graphicsmagick.org).
|
139
|
+
#
|
140
|
+
# @return [Symbol] `:imagemagick` or `:graphicsmagick`
|
141
|
+
#
|
138
142
|
def cli
|
139
|
-
@cli
|
140
|
-
|
143
|
+
if instance_variable_defined?("@cli")
|
144
|
+
instance_variable_get("@cli")
|
145
|
+
else
|
146
|
+
cli = CLI_DETECTION.key(processor) or
|
147
|
+
fail MiniMagick::Error, "You must have ImageMagick or GraphicsMagick installed"
|
148
|
+
|
149
|
+
instance_variable_set("@cli", cli)
|
150
|
+
end
|
141
151
|
end
|
142
152
|
|
153
|
+
##
|
154
|
+
# Set whether you want to use [ImageMagick](http://www.imagemagick.org) or
|
155
|
+
# [GraphicsMagick](http://www.graphicsmagick.org).
|
156
|
+
#
|
143
157
|
def cli=(value)
|
144
158
|
@cli = value
|
145
159
|
|
@@ -150,10 +164,26 @@ module MiniMagick
|
|
150
164
|
end
|
151
165
|
end
|
152
166
|
|
167
|
+
##
|
168
|
+
# If you set the path of CLI tools, you can get the path of the
|
169
|
+
# executables.
|
170
|
+
#
|
171
|
+
# @return [String]
|
172
|
+
#
|
153
173
|
def cli_path
|
154
|
-
@cli_path
|
174
|
+
if instance_variable_defined?("@cli_path")
|
175
|
+
instance_variable_get("@cli_path")
|
176
|
+
else
|
177
|
+
processor_path = instance_variable_get("@processor_path") if instance_variable_defined?("@processor_path")
|
178
|
+
|
179
|
+
instance_variable_set("@cli_path", processor_path)
|
180
|
+
end
|
155
181
|
end
|
156
182
|
|
183
|
+
##
|
184
|
+
# When set to `true`, it outputs each command to STDOUT in their shell
|
185
|
+
# version.
|
186
|
+
#
|
157
187
|
def debug=(value)
|
158
188
|
warn "MiniMagick.debug is deprecated and will be removed in MiniMagick 5. Use `MiniMagick.logger.level = Logger::DEBUG` instead."
|
159
189
|
logger.level = value ? Logger::DEBUG : Logger::INFO
|
data/lib/mini_magick/image.rb
CHANGED
@@ -82,17 +82,15 @@ module MiniMagick
|
|
82
82
|
def self.open(path_or_url, ext = nil, options = {})
|
83
83
|
options, ext = ext, nil if ext.is_a?(Hash)
|
84
84
|
|
85
|
-
|
86
|
-
if File.exist?(path_or_url)
|
87
|
-
File.extname(path_or_url)
|
88
|
-
else
|
89
|
-
File.extname(URI(path_or_url).path)
|
90
|
-
end
|
85
|
+
uri = URI(path_or_url.to_s)
|
91
86
|
|
87
|
+
ext ||= File.extname(uri.path)
|
92
88
|
ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
|
93
89
|
|
94
|
-
|
95
|
-
read(file, ext)
|
90
|
+
if uri.is_a?(URI::HTTP) || uri.is_a?(URI::FTP)
|
91
|
+
uri.open(options) { |file| read(file, ext) }
|
92
|
+
else
|
93
|
+
File.open(uri.to_s, "rb", options) { |file| read(file, ext) }
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
@@ -141,7 +141,7 @@ module MiniMagick
|
|
141
141
|
end
|
142
142
|
|
143
143
|
key, _, value = line.partition(/:[\s]/).map(&:strip)
|
144
|
-
hash = key_stack.inject(details_hash) { |
|
144
|
+
hash = key_stack.inject(details_hash) { |_hash, _key| _hash.fetch(_key) }
|
145
145
|
if value.empty?
|
146
146
|
hash[key] = {}
|
147
147
|
key_stack.push key
|
data/lib/mini_magick/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_magick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.
|
4
|
+
version: 4.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Johnson
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2019-
|
16
|
+
date: 2019-07-11 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rake
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: '0'
|
156
156
|
requirements:
|
157
157
|
- You must have ImageMagick or GraphicsMagick installed
|
158
|
-
rubygems_version: 3.0.
|
158
|
+
rubygems_version: 3.0.3
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
|