mini_magick 4.9.4 → 4.10.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ab4ce03957b9a0f941f9bd2c34a5dcab63faffac5143eb6e7c90d7d860b57c5
4
- data.tar.gz: 7bd78f0c862f1ca72b34e3c6fc4d14297adfa9dd6bc36218a35ef68c235320b5
3
+ metadata.gz: b659ce5ff8d7c13cde3bb32ef1d33faeffe96823f7cda0385001799a224f5362
4
+ data.tar.gz: 44d1c9205e7c72677333401c79c7014202065ca1ed90a397a7a78adf5fd9da32
5
5
  SHA512:
6
- metadata.gz: 16c4bfa3744a2bea117bff0118afcbf89fac2f3d9e92c5c8af2b095f6c1381c1d000bede5086ccffd72ecca8152845cde11a5ff762186bd90793ee5d83e03a77
7
- data.tar.gz: fe593ad2a7bfd4b6f2d9892533fd5347046e7dfb6cfd8e3bc6049cb1ae7686f5af60c23f33254175bca4728a58bdeeab2b9bfb873ebd94c46f14e68e086f002f
6
+ metadata.gz: ff49d5ec4f216b01397ff1897fcfb820e8f223a5a992ed295209491643c1e3f3751a56b9271337083e44808265891e2a755568cdca17df7025f22ce080656a3c
7
+ data.tar.gz: 4b7adad8b9692dabecf26d86a3a61f45708fe8bd37a9580e2668b3a09b40d57d93ffca67c56404da2b738c4612ce1f786658fc92939682aedb7b67a17ea397a7
@@ -110,9 +110,9 @@ module MiniMagick
110
110
  end
111
111
 
112
112
  CLI_DETECTION = {
113
- imagemagick: "mogrify",
114
- graphicsmagick: "gm",
115
113
  imagemagick7: "magick",
114
+ graphicsmagick: "gm",
115
+ imagemagick: "mogrify",
116
116
  }
117
117
 
118
118
  # @private (for backwards compatibility)
@@ -82,15 +82,30 @@ 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
- uri = URI(path_or_url.to_s)
85
+ # Don't use Kernel#open, but reuse its logic
86
+ openable =
87
+ if path_or_url.respond_to?(:open)
88
+ path_or_url
89
+ elsif path_or_url.respond_to?(:to_str) &&
90
+ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ path_or_url &&
91
+ (uri = URI.parse(path_or_url)).respond_to?(:open)
92
+ uri
93
+ else
94
+ options = { binmode: true }.merge(options)
95
+ Pathname(path_or_url)
96
+ end
86
97
 
87
- ext ||= File.extname(uri.path)
98
+ if openable.is_a?(URI::Generic)
99
+ ext ||= File.extname(openable.path)
100
+ else
101
+ ext ||= File.extname(openable.to_s)
102
+ end
88
103
  ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
89
104
 
90
- if uri.is_a?(URI::HTTP) || uri.is_a?(URI::FTP)
91
- uri.open(options) { |file| read(file, ext) }
105
+ if openable.is_a?(URI::Generic)
106
+ openable.open(options) { |file| read(file, ext) }
92
107
  else
93
- File.open(uri.to_s, "rb", options) { |file| read(file, ext) }
108
+ openable.open(**options) { |file| read(file, ext) }
94
109
  end
95
110
  end
96
111
 
@@ -572,5 +587,31 @@ module MiniMagick
572
587
  def layer?
573
588
  path =~ /\[\d+\]$/
574
589
  end
590
+
591
+ ##
592
+ # Compares if image width
593
+ # is greater than height
594
+ # ============
595
+ # | |
596
+ # | |
597
+ # ============
598
+ # @return [Boolean]
599
+ def landscape?
600
+ width > height
601
+ end
602
+
603
+ ##
604
+ # Compares if image height
605
+ # is greater than width
606
+ # ======
607
+ # | |
608
+ # | |
609
+ # | |
610
+ # | |
611
+ # ======
612
+ # @return [Boolean]
613
+ def portrait?
614
+ height > width
615
+ end
575
616
  end
576
617
  end
@@ -0,0 +1,18 @@
1
+ module MiniMagick
2
+ class Image
3
+ def initialize(source)
4
+ if source.is_a?(String) || source.is_a?(Pathname)
5
+ @source_path = source.to_s
6
+ elsif source.respond_to?(:path)
7
+ @source_path = source.path
8
+ else
9
+ fail ArgumentError, "invalid source object: #{source.inspect} (expected String, Pathname or #path)"
10
+ end
11
+ end
12
+
13
+ def method_missing
14
+ end
15
+ end
16
+ end
17
+
18
+ image = MiniMagick::Image.new()
@@ -8,8 +8,8 @@ module MiniMagick
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 4
11
- MINOR = 9
12
- TINY = 4
11
+ MINOR = 10
12
+ TINY = 0
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
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
4
+ version: 4.10.0
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-07-11 00:00:00.000000000 Z
16
+ date: 2020-01-06 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake
@@ -118,6 +118,7 @@ files:
118
118
  - lib/mini_magick/configuration.rb
119
119
  - lib/mini_magick/image.rb
120
120
  - lib/mini_magick/image/info.rb
121
+ - lib/mini_magick/immutable_image.rb
121
122
  - lib/mini_magick/shell.rb
122
123
  - lib/mini_magick/tool.rb
123
124
  - lib/mini_magick/tool/animate.rb
@@ -147,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
148
  requirements:
148
149
  - - ">="
149
150
  - !ruby/object:Gem::Version
150
- version: '0'
151
+ version: '2.0'
151
152
  required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  requirements:
153
154
  - - ">="
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
156
  version: '0'
156
157
  requirements:
157
158
  - You must have ImageMagick or GraphicsMagick installed
158
- rubygems_version: 3.0.3
159
+ rubygems_version: 3.1.2
159
160
  signing_key:
160
161
  specification_version: 4
161
162
  summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick