Sha256: 60b2821d9c439548448f28393d43a1315feef4ebe0be4fbfdd0322349e001e10

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

module Sufia
  module GenericFile
    module Derivatives
      extend ActiveSupport::Concern

      included do
        include Hydra::Derivatives

        makes_derivatives do |obj|
          case obj.mime_type
          when *pdf_mime_types
            obj.transform_file :content, { thumbnail: { format: 'jpg', size: '338x493', datastream: 'thumbnail' } }
          when *office_document_mime_types
            obj.transform_file :content, { thumbnail: { format: 'jpg', size: '200x150>', datastream: 'thumbnail' } }, processor: :document
          when *audio_mime_types
            obj.transform_file :content, { mp3: { format: 'mp3', datastream: 'mp3' }, ogg: { format: 'ogg', datastream: 'ogg' } }, processor: :audio
          when *video_mime_types
            obj.transform_file :content, { webm: { format: 'webm', datastream: 'webm' }, mp4: { format: 'mp4', datastream: 'mp4' }, thumbnail: { format: 'jpg', datastream: 'thumbnail' } }, processor: :video
          when *image_mime_types
            obj.transform_file :content, { thumbnail: { format: 'jpg', size: '200x150>', datastream: 'thumbnail' } }
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
sufia-models-6.2.0 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.1.0 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.0.0 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-6.0.0 sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb
sufia-6.0.0.rc4 sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.0.0.rc4 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-6.0.0.rc3 sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.0.0.rc3 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-6.0.0.rc2 sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.0.0.rc2 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-6.0.0.rc1 sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.0.0.rc1 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-6.0.0.beta1 sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-6.0.0.beta1 app/models/concerns/sufia/generic_file/derivatives.rb
sufia-models-5.0.0.beta1 app/models/concerns/sufia/generic_file/derivatives.rb