class WaxIiif::ImageRecord

Class ImageRecord provides a data structure for a single image file. It contains information for content from the manifest level down to the specific variants of the images.

It has the concept of primary images, which are the first (or only) image in the sequence. This is the image where much of the top-level metadata is taken from. Each sequence can only have a single primary image, but that constraint isnt enforced

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

Attributes

attribution[RW]
description[RW]
id[RW]
is_document[W]
label[RW]
license[RW]
manifest_id[RW]
metadata[RW]
section[W]
section_label[W]
variants[RW]

Public Class Methods

new(opts = {}) click to toggle source

@option opts [String] :label The human-readable label for all grouped records @option opts [String] :description A longer, human-readable description of the gropued records @option opts [String] :logo A URL pointing to a logo of the institution @option opts [Hash] :variants A hash of derivative names and sizes

@example {thumb: 150}

# File lib/wax_iiif/image_record.rb, line 37
def initialize(opts = {})
  opts.each do |key, val|
    self.send("#{key}=", val) if self.methods.include? "#{key}=".to_sym
  end
end

Public Instance Methods

document?() click to toggle source

Is this image part of a document, or is it a standalone image (or image sequence)?

Currently, the only effects the page viewing hint for the image sequence. This will only have an effect on the primary image for this sequence.

@return [Bool]

# File lib/wax_iiif/image_record.rb, line 96
def document?
  !!@is_document
end
image_path() click to toggle source

The path to this image.

@return [String]

# File lib/wax_iiif/image_record.rb, line 46
def image_path
  @path
end
is_primary=(val) click to toggle source

Set this image record as the master record for the sequence

@param [Bool] val Is this image the master

@return [Bool]

# File lib/wax_iiif/image_record.rb, line 122
def is_primary=(val)
  @is_primary = !!val
end
path=(path) click to toggle source
# File lib/wax_iiif/image_record.rb, line 50
def path=(path)
  raise WaxIiif::Error::InvalidImageData, "Path is invalid: '#{path}'" unless path && File.exist?(path)
  @path = path
end
primary?() click to toggle source

Is this image the master image for its sequence?

Each image sequence has a single image chosen as the primary image for the sequence. By default, page one is the master image, but another image could be chosen as the master if desired.

This is, for instance, the image whose thumbnail is the representation for the entire sequence, and it defined viewing direction and other top-level metadata.

@return [Bool]

# File lib/wax_iiif/image_record.rb, line 112
def primary?
  !!@is_primary
end
section() click to toggle source

The name of the section this image is contained in. Currently used to id the canvas for this image.

defaults to WaxIiif::DEFAULT_CANVAS_LABEL

@return [String]

# File lib/wax_iiif/image_record.rb, line 62
def section
  @section || DEFAULT_CANVAS_LABEL
end
section_label() click to toggle source

The label for the section this image is contained in. Currently used to label the canvas for this image.

defaults to WaxIiif::DEFAULT_CANVAS_LABEL

@return [String]

# File lib/wax_iiif/image_record.rb, line 73
def section_label
  @section_label || DEFAULT_CANVAS_LABEL
end
viewing_direction() click to toggle source

@return [String] The prefered viewing direction for this image.

Will default to WaxIiif::DEFAULT_VIEWING_DIRECTION
# File lib/wax_iiif/image_record.rb, line 80
def viewing_direction
  @viewing_direction || DEFAULT_VIEWING_DIRECTION
end
viewing_direction=(dir) click to toggle source
# File lib/wax_iiif/image_record.rb, line 84
def viewing_direction=(dir)
  raise Error::InvalidViewingDirection unless WaxIiif.valid_viewing_direction?(dir)
  @viewing_direction = dir
end