Module: MiniMagick
- Defined in:
- lib/mini_magick.rb,
lib/mini_magick/image.rb,
lib/mini_magick/errors.rb,
lib/mini_magick/version.rb,
lib/mini_magick/utilities.rb,
lib/mini_magick/command_builder.rb
Defined Under Namespace
Modules: Utilities Classes: CommandBuilder, Error, Image, Invalid
Constant Summary collapse
- VERSION =
"3.7.0"
Class Attribute Summary collapse
-
.processor ⇒ Object
Returns the value of attribute processor.
-
.processor_path ⇒ Object
Returns the value of attribute processor_path.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
Class Method Summary collapse
-
.choose_processor ⇒ Object
Tries to detect the current processor based if any of the processors exist.
-
.gm? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s graphicsmagick or not.
-
.image_magick_version ⇒ Object
Discovers the imagemagick version based on mogrify’s output.
-
.minimum_image_magick_version ⇒ Object
The minimum allowed imagemagick version.
-
.mogrify? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s mogrify or not.
-
.valid_version_installed? ⇒ Boolean
Checks whether the imagemagick’s version is valid.
Class Attribute Details
.processor ⇒ Object
Returns the value of attribute processor.
13 14 15 |
# File 'lib/mini_magick.rb', line 13 def processor @processor end |
.processor_path ⇒ Object
Returns the value of attribute processor_path.
14 15 16 |
# File 'lib/mini_magick.rb', line 14 def processor_path @processor_path end |
.timeout ⇒ Object
Returns the value of attribute timeout.
15 16 17 |
# File 'lib/mini_magick.rb', line 15 def timeout @timeout end |
Class Method Details
.choose_processor ⇒ Object
Tries to detect the current processor based if any of the processors exist. Mogrify have precedence over gm by default.
Returns
- String
-
The detected procesor
23 24 25 26 27 28 29 |
# File 'lib/mini_magick.rb', line 23 def choose_processor if MiniMagick::Utilities.which('mogrify').size > 0 self.processor = 'mogrify' elsif MiniMagick::Utilities.which('gm').size > 0 self.processor = "gm" end end |
.gm? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s graphicsmagick or not.
Returns
- Boolean
74 75 76 77 78 |
# File 'lib/mini_magick.rb', line 74 def gm? self.choose_processor if self.processor.nil? self.processor == 'gm' end |
.image_magick_version ⇒ Object
Discovers the imagemagick version based on mogrify’s output.
Returns
-
The imagemagick version
36 37 38 |
# File 'lib/mini_magick.rb', line 36 def image_magick_version @@version ||= Gem::Version.create(`mogrify --version`.split(" ")[2].split("-").first) end |
.minimum_image_magick_version ⇒ Object
The minimum allowed imagemagick version
Returns
-
The minimum imagemagick version
45 46 47 |
# File 'lib/mini_magick.rb', line 45 def minimum_image_magick_version @@minimum_version ||= Gem::Version.create("6.6.3") end |
.mogrify? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s mogrify or not.
Returns
- Boolean
63 64 65 66 67 |
# File 'lib/mini_magick.rb', line 63 def mogrify? self.choose_processor if self.processor.nil? self.processor == 'mogrify' end |
.valid_version_installed? ⇒ Boolean
Checks whether the imagemagick’s version is valid
Returns
- Boolean
54 55 56 |
# File 'lib/mini_magick.rb', line 54 def valid_version_installed? image_magick_version >= minimum_image_magick_version end |