class IiifS3::ImageTile

Class ImageTile is a specific ImageVariant used when generating a stack of tiles suitable for Mirador-style zooming interfaces. Each instance of ImageTile represents a single tile.

@author David Newbury <david.newbury@gmail.com>

Public Class Methods

new(data, config, tile) click to toggle source

Initializing this

@param [Hash] data A Image Data object. @param [IiifS3::Config] config The configuration object @param [Hash<width: Number, height: Number, x Number, y: Number, xSize: Number, ySize: Number>] tile

A hash of parameters that defines this tile.
Calls superclass method
# File lib/iiif_s3/image_tile.rb, line 23
def initialize(data, config, tile)
  @tile = tile
  super(data, config)
end

Protected Instance Methods

filestring() click to toggle source
# File lib/iiif_s3/image_tile.rb, line 41
def filestring
  "/#{region}/#{@tile[:xSize]},/0"
end
region() click to toggle source
# File lib/iiif_s3/image_tile.rb, line 37
def region
  "#{@tile[:x]},#{@tile[:y]},#{@tile[:width]},#{@tile[:height]}"
end
resize(width=nil,height=nil) click to toggle source
# File lib/iiif_s3/image_tile.rb, line 30
def resize(width=nil,height=nil)
  @image.combine_options do |img|
    img.crop "#{@tile[:width]}x#{@tile[:height]}+#{@tile[:x]}+#{@tile[:y]}"
    img.resize "#{@tile[:xSize]}x#{@tile[:ySize]}"
  end
end