Module: ImageProcessing::MiniMagick
- Extended by:
- Chainable
- Defined in:
- lib/image_processing/mini_magick.rb
Defined Under Namespace
Classes: Processor
Constant Summary collapse
- INHERIT_FDS_MINIMUM_VERSION =
mini_magick gained
inherit_fds:on MiniMagick::Shell#execute in 5.4.0. Gem::Version.new("5.4.0")
Class Method Summary collapse
- .convert_shim(inherit_fds: nil, &block) ⇒ Object
-
.valid_image?(file) ⇒ Boolean
Returns whether the given image file is processable.
Methods included from Chainable
apply, branch, call, convert, instrumenter, loader, operation, saver, source
Class Method Details
.convert_shim(inherit_fds: nil, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/image_processing/mini_magick.rb', line 15 def self.convert_shim(inherit_fds: nil, &block) if inherit_fds && ::MiniMagick.version < INHERIT_FDS_MINIMUM_VERSION raise LoadError, "The `inherit_fds` loader option requires mini_magick #{INHERIT_FDS_MINIMUM_VERSION} or newer, but mini_magick #{::MiniMagick.version} is loaded. Please upgrade the gem." end = inherit_fds ? { inherit_fds: inherit_fds } : {} if ::MiniMagick.respond_to?(:convert) ::MiniMagick.convert(**, &block) else ::MiniMagick::Tool::Convert.new(**, &block) end end |
.valid_image?(file) ⇒ Boolean
Returns whether the given image file is processable.
30 31 32 33 34 35 36 37 38 |
# File 'lib/image_processing/mini_magick.rb', line 30 def self.valid_image?(file) convert_shim do |convert| convert << file.path convert << "null:" end true rescue ::MiniMagick::Error false end |