mini_magick 3.0 → 3.1
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.
Potentially problematic release.
This version of mini_magick might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/lib/mini_magick.rb +12 -8
- data/test/image_test.rb +1 -1
- data/test/leaves.tiff b/data/test/leaves → spaced.tiff +0 -0
- metadata +19 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.1
|
data/lib/mini_magick.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'subexec'
|
3
|
+
require 'pathname'
|
3
4
|
|
4
5
|
module MiniMagick
|
5
6
|
class << self
|
@@ -129,7 +130,10 @@ module MiniMagick
|
|
129
130
|
@path = input_path
|
130
131
|
@tempfile = tempfile # ensures that the tempfile will stick around until this image is garbage collected.
|
131
132
|
end
|
132
|
-
|
133
|
+
|
134
|
+
def escaped_path
|
135
|
+
Pathname.new(@path).to_s.gsub(" ", "\\ ")
|
136
|
+
end
|
133
137
|
|
134
138
|
# Checks to make sure that MiniMagick can read the file and understand it.
|
135
139
|
#
|
@@ -164,27 +168,27 @@ module MiniMagick
|
|
164
168
|
# Why do I go to the trouble of putting in newlines? Because otherwise animated gifs screw everything up
|
165
169
|
case value.to_s
|
166
170
|
when "format"
|
167
|
-
run_command("identify", "-format", format_option("%m"),
|
171
|
+
run_command("identify", "-format", format_option("%m"), escaped_path).split("\n")[0]
|
168
172
|
when "height"
|
169
|
-
run_command("identify", "-format", format_option("%h"),
|
173
|
+
run_command("identify", "-format", format_option("%h"), escaped_path).split("\n")[0].to_i
|
170
174
|
when "width"
|
171
|
-
run_command("identify", "-format", format_option("%w"),
|
175
|
+
run_command("identify", "-format", format_option("%w"), escaped_path).split("\n")[0].to_i
|
172
176
|
when "dimensions"
|
173
|
-
run_command("identify", "-format", format_option("%w %h"),
|
177
|
+
run_command("identify", "-format", format_option("%w %h"), escaped_path).split("\n")[0].split.map{|v|v.to_i}
|
174
178
|
when "size"
|
175
179
|
File.size(@path) # Do this because calling identify -format "%b" on an animated gif fails!
|
176
180
|
when "original_at"
|
177
181
|
# Get the EXIF original capture as a Time object
|
178
182
|
Time.local(*self["EXIF:DateTimeOriginal"].split(/:|\s+/)) rescue nil
|
179
183
|
when /^EXIF\:/i
|
180
|
-
result = run_command('identify', '-format', "\"%[#{value}]\"",
|
184
|
+
result = run_command('identify', '-format', "\"%[#{value}]\"", escaped_path).chop
|
181
185
|
if result.include?(",")
|
182
186
|
read_character_data(result)
|
183
187
|
else
|
184
188
|
result
|
185
189
|
end
|
186
190
|
else
|
187
|
-
run_command('identify', '-format', "\"#{value}\"",
|
191
|
+
run_command('identify', '-format', "\"#{value}\"", escaped_path).split("\n")[0]
|
188
192
|
end
|
189
193
|
end
|
190
194
|
|
@@ -194,7 +198,7 @@ module MiniMagick
|
|
194
198
|
#
|
195
199
|
# @return [String] Whatever the result from the command line is. May not be terribly useful.
|
196
200
|
def <<(*args)
|
197
|
-
run_command("mogrify", *args <<
|
201
|
+
run_command("mogrify", *args << escaped_path)
|
198
202
|
end
|
199
203
|
|
200
204
|
# This is used to change the format of the image. That is, from "tiff to jpg" or something like that.
|
data/test/image_test.rb
CHANGED
@@ -14,7 +14,7 @@ class ImageTest < Test::Unit::TestCase
|
|
14
14
|
|
15
15
|
SIMPLE_IMAGE_PATH = CURRENT_DIR + "simple.gif"
|
16
16
|
MINUS_IMAGE_PATH = CURRENT_DIR + "simple-minus.gif"
|
17
|
-
TIFF_IMAGE_PATH = CURRENT_DIR + "leaves.tiff"
|
17
|
+
TIFF_IMAGE_PATH = CURRENT_DIR + "leaves spaced.tiff"
|
18
18
|
NOT_AN_IMAGE_PATH = CURRENT_DIR + "not_an_image.php"
|
19
19
|
GIF_WITH_JPG_EXT = CURRENT_DIR + "actually_a_gif.jpg"
|
20
20
|
EXIF_IMAGE_PATH = CURRENT_DIR + "trogdor.jpg"
|
File without changes
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 3
|
7
|
-
-
|
8
|
-
version: "3.
|
7
|
+
- 1
|
8
|
+
version: "3.1"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Corey Johnson
|
@@ -15,13 +15,14 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-09 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: subexec
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ~>
|
27
28
|
- !ruby/object:Gem::Version
|
@@ -36,6 +37,7 @@ dependencies:
|
|
36
37
|
name: mocha
|
37
38
|
prerelease: false
|
38
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
39
41
|
requirements:
|
40
42
|
- - ~>
|
41
43
|
- !ruby/object:Gem::Version
|
@@ -64,6 +66,16 @@ files:
|
|
64
66
|
- Rakefile
|
65
67
|
- lib/mini_gmagick.rb
|
66
68
|
- lib/mini_magick.rb
|
69
|
+
- test/actually_a_gif.jpg
|
70
|
+
- test/animation.gif
|
71
|
+
- test/command_builder_test.rb
|
72
|
+
- test/composited.jpg
|
73
|
+
- test/image_test.rb
|
74
|
+
- test/leaves spaced.tiff
|
75
|
+
- test/not_an_image.php
|
76
|
+
- test/simple-minus.gif
|
77
|
+
- test/simple.gif
|
78
|
+
- test/trogdor.jpg
|
67
79
|
has_rdoc: true
|
68
80
|
homepage: http://github.com/probablycorey/mini_magick
|
69
81
|
licenses: []
|
@@ -74,6 +86,7 @@ rdoc_options: []
|
|
74
86
|
require_paths:
|
75
87
|
- lib
|
76
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
77
90
|
requirements:
|
78
91
|
- - ">="
|
79
92
|
- !ruby/object:Gem::Version
|
@@ -81,6 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
94
|
- 0
|
82
95
|
version: "0"
|
83
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
84
98
|
requirements:
|
85
99
|
- - ">="
|
86
100
|
- !ruby/object:Gem::Version
|
@@ -90,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
104
|
requirements: []
|
91
105
|
|
92
106
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.3.
|
107
|
+
rubygems_version: 1.3.7
|
94
108
|
signing_key:
|
95
109
|
specification_version: 3
|
96
110
|
summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
|
@@ -100,7 +114,7 @@ test_files:
|
|
100
114
|
- test/command_builder_test.rb
|
101
115
|
- test/composited.jpg
|
102
116
|
- test/image_test.rb
|
103
|
-
- test/leaves.tiff
|
117
|
+
- test/leaves spaced.tiff
|
104
118
|
- test/not_an_image.php
|
105
119
|
- test/simple-minus.gif
|
106
120
|
- test/simple.gif
|