Module: Hyrax::DisplaysImage

Extended by:
ActiveSupport::Concern
Included in:
FileSetPresenter, IiifManifestPresenter::DisplayImagePresenter
Defined in:
app/presenters/hyrax/displays_image.rb

Overview

This gets mixed into FileSetPresenter in order to create a canvas on a IIIF manifest

Instance Method Summary collapse

Instance Method Details

#display_imageIIIFManifest::DisplayImage

Creates a display image only where FileSet is an image.

Returns:

  • (IIIFManifest::DisplayImage)

    the display image required by the manifest builder.



13
14
15
16
17
18
19
20
21
22
23
# File 'app/presenters/hyrax/displays_image.rb', line 13

def display_image
  return nil unless solr_document.image? && current_ability.can?(:read, solr_document)
  return nil unless latest_file_id

  # @see https://github.com/samvera-labs/iiif_manifest
  IIIFManifest::DisplayImage.new(display_image_url(request.base_url),
                                 format: image_format(alpha_channels),
                                 width: width,
                                 height: height,
                                 iiif_endpoint: iiif_endpoint(latest_file_id))
end