Class: IiifS3::Thumbnail

Inherits:
ImageVariant show all
Defined in:
lib/iiif_s3/thumbnail.rb

Overview

Class Thumbnail provides a specific variant of an image file used for the thumbnail links within the metadata. It will generate a consistent sized version based on a max width and height. By default, it generates images at 250px on the longest size.

Author:

Instance Attribute Summary

Attributes inherited from ImageVariant

#id, #uri

Instance Method Summary collapse

Methods inherited from ImageVariant

#generate_image_id, #height, #mime_type, #width

Methods included from Utilities::Helpers

#add_default_redirect, #add_file_to_s3, #generate_build_location, #generate_id, #generate_image_location, #get_data_path, #get_s3_key, #save_to_disk

Constructor Details

#initialize(data, config, max_width = nil, max_height = nil) ⇒ Thumbnail

Initialize a new thumbnail.

Parameters:

  • data (hash)

    The image data object

  • config (Hash)

    The configuration hash

  • max_width (Integer) (defaults to: nil)

    The maximum width of the thumbnail

  • max_height (Integer) (defaults to: nil)

    The maximum height of the thumbnail



22
23
24
25
26
# File 'lib/iiif_s3/thumbnail.rb', line 22

def initialize(data, config, max_width=nil, max_height = nil)
  @max_width = max_width || config.thumbnail_size
  @max_height = max_height || config.thumbnail_size
  super(data,config)
end