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 (#id)
    • to get the thumbnail for

Returns:

  • (String)

    a path to the thumbnail



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

def call(object)
  return default_image if object.try(:thumbnail_id).blank?

  thumb = fetch_thumbnail(object)

  return default_image unless thumb
  return call(thumb) unless thumb.file_set?
  if audio?(thumb)
    audio_image
  elsif thumbnail?(thumb)
    thumbnail_path(thumb)
  else
    default_image
  end
end