Class: Poleica::Converters::GraphicsMagick
- Inherits:
-
Object
- Object
- Poleica::Converters::GraphicsMagick
- Includes:
- Utils
- Defined in:
- lib/poleica/converters/graphics_magick/graphics_magick.rb,
lib/poleica/converters/graphics_magick/convert_options_generator.rb,
lib/poleica/converters/graphics_magick/thumbnail_options_generator.rb
Overview
The GraphicsMagick converter, use the ‘gm’ command to convert images and documents
Defined Under Namespace
Classes: ConvertOptionsGenerator, ThumbnailOptionsGenerator
Constant Summary collapse
Instance Attribute Summary collapse
-
#polei ⇒ Object
readonly
Returns the value of attribute polei.
Instance Method Summary collapse
-
#initialize(polei) ⇒ GraphicsMagick
constructor
A new instance of GraphicsMagick.
- #to_png(options = {}) ⇒ Object
- #to_thumbnail(options = {}) ⇒ Object
Methods included from Utils
#bin_path, exec_with_timeout, extract_extension_and_options, fail_if_error, #host_os, init_process_std, #linux?, map_std, #osx?, #underscorize, #windows?
Constructor Details
#initialize(polei) ⇒ GraphicsMagick
Returns a new instance of GraphicsMagick.
18 19 20 |
# File 'lib/poleica/converters/graphics_magick/graphics_magick.rb', line 18 def initialize(polei) @polei = polei end |
Instance Attribute Details
#polei ⇒ Object (readonly)
Returns the value of attribute polei.
16 17 18 |
# File 'lib/poleica/converters/graphics_magick/graphics_magick.rb', line 16 def polei @polei end |
Instance Method Details
#to_png(options = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/poleica/converters/graphics_magick/graphics_magick.rb', line 22 def to_png( = {}) opts_gen = ConvertOptionsGenerator.new(polei, ) exec_with_timeout(bin_path, opts_gen.generate) expected_file_path = opts_gen.output_path File.exist?(expected_file_path) ? expected_file_path : nil end |
#to_thumbnail(options = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/poleica/converters/graphics_magick/graphics_magick.rb', line 29 def to_thumbnail( = {}) opts_gen = ThumbnailOptionsGenerator.new(polei, ) exec_with_timeout(bin_path, opts_gen.generate) expected_file_path = opts_gen.output_path File.exist?(expected_file_path) ? expected_file_path : nil end |