Class: Hydra::Derivatives::Image

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

Instance Attribute Summary

Attributes inherited from Processor

#directives, #object, #source_name

Instance Method Summary collapse

Methods inherited from Processor

#initialize, #output_datastream, #output_datastream_id, #source_datastream

Constructor Details

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

Instance Method Details

#processObject



5
6
7
8
9
10
11
12
# File 'lib/hydra/derivatives/image.rb', line 5

def process
  directives.each do |name, args| 
    opts = args.kind_of?(Hash) ? args : {size: args}
    format = opts.fetch(:format, 'png')
    output_datastream_name = opts.fetch(:datastream, output_datastream_id(name))
    create_resized_image(output_datastream(output_datastream_name), opts[:size], format)
  end
end