Merge pull request #286 from jpstroop/master
Support IIIF servers that don't report tile dimensions
@ -51,7 +51,12 @@ $.IIIF1_1TileSource = function( options ){
|
|||||||
throw new Error('IIIF required parameters not provided.');
|
throw new Error('IIIF required parameters not provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
options.tileSize = this.tile_width;
|
if ( !(this.tile_width && this.tile_height) ) {
|
||||||
|
// use the short dimension if there aren't tile sizes provided.
|
||||||
|
options.tileSize = Math.min(this.height, this.width);
|
||||||
|
} else {
|
||||||
|
options.tileSize = this.tile_width;
|
||||||
|
}
|
||||||
|
|
||||||
if (! options.maxLevel ) {
|
if (! options.maxLevel ) {
|
||||||
var mf = -1;
|
var mf = -1;
|
||||||
@ -83,7 +88,6 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, {
|
|||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" == data.profile ||
|
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0" == data.profile ||
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1" == data.profile ||
|
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1" == data.profile ||
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2" == data.profile ||
|
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2" == data.profile ||
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level3" == data.profile ||
|
|
||||||
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html" == data.profile
|
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html" == data.profile
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
19
test/data/iiif_no_tiles.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",
|
||||||
|
"height": 850,
|
||||||
|
"width": 1024,
|
||||||
|
"qualities": [
|
||||||
|
"native",
|
||||||
|
"color",
|
||||||
|
"grey",
|
||||||
|
"bitonal"
|
||||||
|
],
|
||||||
|
"formats": [
|
||||||
|
"jpg",
|
||||||
|
"png",
|
||||||
|
"gif"
|
||||||
|
],
|
||||||
|
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
|
||||||
|
"@id": "http://localhost:8000/test/data/iiif_no_tiles"
|
||||||
|
}
|
||||||
|
|
BIN
test/data/iiif_no_tiles/0,0,1024,850/128,107/0/native.jpg
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
test/data/iiif_no_tiles/0,0,1024,850/16,14/0/native.jpg
Normal file
After Width: | Height: | Size: 829 B |
BIN
test/data/iiif_no_tiles/0,0,1024,850/256,213/0/native.jpg
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
test/data/iiif_no_tiles/0,0,1024,850/32,27/0/native.jpg
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
test/data/iiif_no_tiles/0,0,1024,850/512,425/0/native.jpg
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
test/data/iiif_no_tiles/0,0,1024,850/64,54/0/native.jpg
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
test/data/iiif_no_tiles/0,0,1024,850/8,7/0/native.jpg
Normal file
After Width: | Height: | Size: 691 B |
BIN
test/data/iiif_no_tiles/full/full/0/native.jpg
Normal file
After Width: | Height: | Size: 351 KiB |
@ -80,4 +80,9 @@
|
|||||||
testOpen('iiif1_1.json');
|
testOpen('iiif1_1.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('IIIF No Tiles', function() {
|
||||||
|
testOpen('iiif_no_tiles.json');
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|