Sha256: 3f8d2e044626d249cf77f415e3b4b5833cdca104f2c97a282290aa5f61049ad8

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

module Hydra::Works
  class GenerateThumbnail

    def self.call(object, content: :original_file)
      raise ArgumentError, "object has no content at #{content} from which to generate a thumbnail" if object.send(content).nil?
      source = object.send(content)

      # Always replace the thumbnail with whatever is from the original file
      if object.thumbnail.nil?
        object.files.build
        AddTypeToFile.call(object.files.last, ::RDF::URI("http://pcdm.org/ThumbnailImage"))
      end
      
      object.create_derivatives
      object
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydra-works-0.0.1 lib/hydra/works/services/generic_file/generate/thumbnail.rb