Class: Hydra::Derivatives::Processors::Image
- Defined in:
- lib/hydra/derivatives/processors/image.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Processor
#directives, #output_file_service, #source_path
Instance Method Summary collapse
Methods inherited from Processor
#initialize, #output_file, #output_file_id, #output_filename_for
Constructor Details
This class inherits a constructor from Hydra::Derivatives::Processors::Processor
Instance Method Details
#process ⇒ Object
7 8 9 |
# File 'lib/hydra/derivatives/processors/image.rb', line 7 def process timeout ? process_with_timeout : process_without_timeout end |
#process_with_timeout ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/hydra/derivatives/processors/image.rb', line 11 def process_with_timeout status = Timeout::timeout(timeout) do process_without_timeout end rescue Timeout::Error => ex raise Hydra::Derivatives::TimeoutError, "Unable to process image derivative\nThe command took longer than #{timeout} seconds to execute" end |
#process_without_timeout ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/hydra/derivatives/processors/image.rb', line 19 def process_without_timeout format = directives.fetch(:format) name = directives.fetch(:label, format) destination_name = output_filename_for(name) size = directives.fetch(:size, nil) quality = directives.fetch(:quality, nil) create_resized_image(destination_name, size, format, quality) end |