Class: Hyrax::IiifManifestPresenter::DisplayImagePresenter

Inherits:
Draper::Decorator
  • Object
show all
Includes:
AnnotatesContent, DisplaysContent, DisplaysImage
Defined in:
app/presenters/hyrax/iiif_manifest_presenter.rb

Overview

a Presenter for producing IIIFManifest::DisplayImage objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AnnotatesContent

#annotation_content

Methods included from DisplaysTranscripts

#language_code, #transcript_url, #transcripts

Methods included from DisplaysContent

#display_content

Instance Attribute Details

#ability#can?

Returns:

  • (#can?)


235
236
237
# File 'app/presenters/hyrax/iiif_manifest_presenter.rb', line 235

def ability
  @ability ||= NullAbility.new
end

#hostnameString

Returns:

  • (String)


241
242
243
# File 'app/presenters/hyrax/iiif_manifest_presenter.rb', line 241

def hostname
  @hostname || 'localhost'
end

Instance Method Details

#display_imageIIIFManifest::DisplayImage

Creates a display image only where #model is an image.

Returns:

  • (IIIFManifest::DisplayImage)

    the display image required by the manifest builder.



220
221
222
223
224
225
226
227
228
229
230
231
# File 'app/presenters/hyrax/iiif_manifest_presenter.rb', line 220

def display_image
  return nil if Hyrax.config.iiif_manifest_factory == ::IIIFManifest::V3::ManifestFactory
  return nil unless model.image?
  return nil unless latest_file_id

  IIIFManifest::DisplayImage
    .new(display_image_url(hostname),
         format: image_format(alpha_channels),
         width: width,
         height: height,
         iiif_endpoint: iiif_endpoint(latest_file_id, base_url: hostname))
end

#work?Boolean

Returns false.

Returns:

  • (Boolean)

    false



247
248
249
# File 'app/presenters/hyrax/iiif_manifest_presenter.rb', line 247

def work?
  false
end