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



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

def process
  timeout ? process_with_timeout : create_resized_image
end

#process_with_timeoutObject



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

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