Class: Openseadragon::Image

Inherits:
Object
  • Object
show all
Defined in:
app/models/openseadragon/image.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Image

Returns a new instance of Image.



13
14
15
16
17
# File 'app/models/openseadragon/image.rb', line 13

def initialize(attributes = {})
  self.id = attributes[:id]
  self.width = attributes[:width]
  self.height = attributes[:height]
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



3
4
5
# File 'app/models/openseadragon/image.rb', line 3

def height
  @height
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'app/models/openseadragon/image.rb', line 3

def id
  @id
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'app/models/openseadragon/image.rb', line 3

def width
  @width
end

Class Method Details

.find(id) ⇒ Object



8
9
10
# File 'app/models/openseadragon/image.rb', line 8

def find(id)
  file_resolver.find(id)
end

Instance Method Details

#to_tilesourceObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/openseadragon/image.rb', line 19

def to_tilesource
  {
    identifier: id,
    width: width,
    height: height,
    scale_factors: [1, 2, 3, 4, 5],
    formats: [:jpg, :png],
    qualities: [:native, :bitonal, :grey, :color],
    profile: "http://library.stanford.edu/iiif/image-api/compliance.html#level3",
    tile_width: 1024,
    tile_height: 1024,
    image_host: '/image-service',
  }
end