Class: Hydra::Derivatives::Processors::Image

Inherits:
Processor
  • Object
show all
Defined in:
lib/hydra/derivatives/processors/image.rb

Direct Known Subclasses

RawImage

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_filename_for

Constructor Details

This class inherits a constructor from Hydra::Derivatives::Processors::Processor

Instance Method Details

#processObject



7
8
9
# File 'lib/hydra/derivatives/processors/image.rb', line 7

def process
  timeout ? process_with_timeout : create_resized_image
end

#process_with_timeoutObject



11
12
13
14
15
# File 'lib/hydra/derivatives/processors/image.rb', line 11

def process_with_timeout
  Timeout.timeout(timeout) { create_resized_image }
rescue Timeout::Error
  raise Hydra::Derivatives::TimeoutError, "Unable to process image derivative\nThe command took longer than #{timeout} seconds to execute"
end