Class: Hyrax::ThumbnailPathService

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/thumbnail_path_service.rb

Class Method Summary collapse

Class Method Details

.call(object) ⇒ String

Returns a path to the thumbnail.

Parameters:

  • object (Work, FileSet)
    • to get the thumbnail for

Returns:

  • (String)

    a path to the thumbnail



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/hyrax/thumbnail_path_service.rb', line 6

def call(object)
  return default_image unless object.thumbnail_id

  thumb = fetch_thumbnail(object)
  return unless thumb
  return call(thumb) unless thumb.is_a?(::FileSet)
  if thumb.audio?
    audio_image
  elsif thumbnail?(thumb)
    thumbnail_path(thumb)
  else
    default_image
  end
end