class IiifS3::Thumbnail

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 David Newbury <david.newbury@gmail.com>

Public Class Methods

new(data, config, max_width=nil, max_height = nil) click to toggle source

Initialize a new thumbnail.

@param [hash] data The image data object @param [Hash] config The configuration hash @param [Integer] max_width The maximum width of the thumbnail @param [Integer] max_height The maximum height of the thumbnail

Calls superclass method IiifS3::ImageVariant::new
# 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

Protected Instance Methods

resize(width, height) click to toggle source
# File lib/iiif_s3/thumbnail.rb, line 30
def resize(width, height)
  @image.resize "#{@max_width}x#{@max_height}"
end