mini_magick 3.2.1 → 3.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mini_magick might be problematic. Click here for more details.

data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
4
- require 'rake/gempackagetask'
3
+ require 'rdoc/task'
4
+ require 'rubygems/package_task'
5
5
 
6
6
  $:.unshift(File.dirname(__FILE__) + "/lib")
7
7
  require 'mini_magick'
@@ -27,6 +27,8 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
27
27
  end
28
28
 
29
29
  spec = eval(File.read('mini_magick.gemspec'))
30
- Rake::GemPackageTask.new(spec) do |pkg|
30
+ Gem::PackageTask.new(spec) do |pkg|
31
31
  pkg.gem_spec = spec
32
+ pkg.need_zip = true
33
+ pkg.need_tar = true
32
34
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 3.3
@@ -133,7 +133,7 @@ module MiniMagick
133
133
  # @return [Image] The created image
134
134
  def create(ext = nil, validate = true, &block)
135
135
  begin
136
- tempfile = Tempfile.new(['mini_magick', ext.to_s])
136
+ tempfile = Tempfile.new(['mini_magick', ext.to_s.downcase])
137
137
  tempfile.binmode
138
138
  block.call(tempfile)
139
139
  tempfile.close
@@ -164,7 +164,7 @@ module MiniMagick
164
164
  end
165
165
 
166
166
  def escaped_path
167
- "\"#{Pathname.new(@path).to_s}\""
167
+ Pathname.new(@path).to_s.inspect
168
168
  end
169
169
 
170
170
  # Checks to make sure that MiniMagick can read the file and understand it.
@@ -288,9 +288,7 @@ module MiniMagick
288
288
  def write(output_to)
289
289
  if output_to.kind_of?(String) || !output_to.respond_to?(:write)
290
290
  FileUtils.copy_file @path, output_to
291
- # We need to escape the output path if it contains a space
292
- escaped_output_to = output_to.to_s.gsub(' ', '\\ ')
293
- run_command "identify", escaped_output_to # Verify that we have a good image
291
+ run_command "identify", output_to.to_s.inspect # Verify that we have a good image
294
292
  else # stream
295
293
  File.open(@path, "rb") do |f|
296
294
  f.binmode
@@ -311,6 +309,11 @@ module MiniMagick
311
309
  ensure
312
310
  f.close if f
313
311
  end
312
+
313
+ def mime_type
314
+ format = self[:format]
315
+ "image/"+format.downcase
316
+ end
314
317
 
315
318
  # If an unknown method is called then it is sent through the morgrify program
316
319
  # Look here to find all the commands (http://www.imagemagick.org/script/mogrify.php)
@@ -16,7 +16,9 @@ class ImageTest < Test::Unit::TestCase
16
16
  NOT_AN_IMAGE_PATH = CURRENT_DIR + "not_an_image.php"
17
17
  GIF_WITH_JPG_EXT = CURRENT_DIR + "actually_a_gif.jpg"
18
18
  EXIF_IMAGE_PATH = CURRENT_DIR + "trogdor.jpg"
19
+ CAP_EXT_PATH = CURRENT_DIR + "trogdor_capitalized.JPG"
19
20
  ANIMATION_PATH = CURRENT_DIR + "animation.gif"
21
+ PNG_PATH = CURRENT_DIR + "png.png"
20
22
 
21
23
  def test_image_from_blob
22
24
  File.open(SIMPLE_IMAGE_PATH, "rb") do |f|
@@ -62,6 +64,11 @@ class ImageTest < Test::Unit::TestCase
62
64
  assert image.valid?
63
65
  image.destroy!
64
66
  end
67
+
68
+ def test_reformat_with_capitalized_extension
69
+ image = Image.open(CAP_EXT_PATH)
70
+ image.format "jpg"
71
+ end
65
72
 
66
73
  def test_image_write
67
74
  output_path = "output.gif"
@@ -275,7 +282,7 @@ class ImageTest < Test::Unit::TestCase
275
282
  img.gravity "Center"
276
283
  img.crop "480x480"
277
284
  img.resize "250x250"
278
- img.write CURRENT_DIR + "output.png"
285
+ img.write "/tmp/output.png"
279
286
  end
280
287
 
281
288
  def test_throw_format_error
@@ -300,7 +307,7 @@ class ImageTest < Test::Unit::TestCase
300
307
  assert_equal "png", image[:format].downcase
301
308
  assert_equal columns, image[:width]
302
309
  assert_equal rows, image[:height]
303
- image.write(CURRENT_DIR + "imported_pixels_image.png")
310
+ image.write("/tmp/imported_pixels_image.png")
304
311
  end
305
312
 
306
313
  def test_import_pixels_custom_format
@@ -316,7 +323,20 @@ class ImageTest < Test::Unit::TestCase
316
323
  assert_equal format, image[:format].downcase
317
324
  assert_equal columns, image[:width]
318
325
  assert_equal rows, image[:height]
319
- image.write(CURRENT_DIR + "imported_pixels_image." + format)
326
+ image.write("/tmp/imported_pixels_image." + format)
327
+ end
328
+
329
+ def test_mime_type
330
+ gif = Image.open(SIMPLE_IMAGE_PATH)
331
+ jpeg = Image.open(EXIF_IMAGE_PATH)
332
+ png = Image.open(PNG_PATH)
333
+ tiff = Image.open(TIFF_IMAGE_PATH)
334
+ hidden_gif = Image.open(GIF_WITH_JPG_EXT)
335
+
336
+ assert_equal "image/gif", gif.mime_type
337
+ assert_equal "image/jpeg", jpeg.mime_type
338
+ assert_equal "image/png", png.mime_type
339
+ assert_equal "image/tiff", tiff.mime_type
340
+ assert_equal "image/gif", hidden_gif.mime_type
320
341
  end
321
-
322
342
  end
Binary file
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_magick
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 3
7
- - 2
8
- - 1
9
- version: 3.2.1
4
+ prerelease:
5
+ version: "3.3"
10
6
  platform: ruby
11
7
  authors:
12
8
  - Corey Johnson
@@ -16,21 +12,18 @@ autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
14
 
19
- date: 2011-04-28 00:00:00 +01:00
15
+ date: 2011-06-02 00:00:00 -04:00
20
16
  default_executable:
21
17
  dependencies:
22
18
  - !ruby/object:Gem::Dependency
23
19
  name: subexec
24
20
  prerelease: false
25
21
  requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
- - 0
32
- - 4
33
- version: 0.0.4
26
+ version: 0.1.0
34
27
  type: :runtime
35
28
  version_requirements: *id001
36
29
  description: ""
@@ -51,6 +44,18 @@ files:
51
44
  - Rakefile
52
45
  - lib/mini_gmagick.rb
53
46
  - lib/mini_magick.rb
47
+ - test/actually_a_gif.jpg
48
+ - test/animation.gif
49
+ - test/command_builder_test.rb
50
+ - test/composited.jpg
51
+ - test/image_test.rb
52
+ - test/leaves (spaced).tiff
53
+ - test/not_an_image.php
54
+ - test/png.png
55
+ - test/simple-minus.gif
56
+ - test/simple.gif
57
+ - test/trogdor.jpg
58
+ - test/trogdor_capitalized.JPG
54
59
  has_rdoc: true
55
60
  homepage: http://github.com/probablycorey/mini_magick
56
61
  licenses: []
@@ -61,23 +66,21 @@ rdoc_options: []
61
66
  require_paths:
62
67
  - lib
63
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
64
70
  requirements:
65
71
  - - ">="
66
72
  - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
73
  version: "0"
70
74
  required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
71
76
  requirements:
72
77
  - - ">="
73
78
  - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
79
  version: "0"
77
80
  requirements: []
78
81
 
79
82
  rubyforge_project:
80
- rubygems_version: 1.3.6
83
+ rubygems_version: 1.6.2
81
84
  signing_key:
82
85
  specification_version: 3
83
86
  summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
@@ -89,6 +92,8 @@ test_files:
89
92
  - test/image_test.rb
90
93
  - test/leaves (spaced).tiff
91
94
  - test/not_an_image.php
95
+ - test/png.png
92
96
  - test/simple-minus.gif
93
97
  - test/simple.gif
94
98
  - test/trogdor.jpg
99
+ - test/trogdor_capitalized.JPG