diff --git a/changelog.txt b/changelog.txt index 9824e9e9..d16a6d4e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -54,6 +54,7 @@ OPENSEADRAGON CHANGELOG * Viewer.innerTracker.dragHandler: preventDefaultAction == true prevents viewer panning with mouse/touch * Viewer.innerTracker.scrollHandler: preventDefaultAction == true prevents viewer zooming on mousewheel/pinch * Fixed: IE8 error with custom buttons - "Object doesn't support this action" (#279) +* Support IIIF servers that don't report tile dimensions (#286) 0.9.131: diff --git a/package.json b/package.json index 73c90e02..63c432b9 100644 --- a/package.json +++ b/package.json @@ -3,17 +3,17 @@ "version": "0.9.131", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "devDependencies": { - "grunt": "~0.4.0", - "grunt-contrib-compress": "~0.5.0", - "grunt-contrib-concat": "~0.1.2", - "grunt-contrib-jshint": "~0.6.0", - "grunt-contrib-uglify": "~0.2.2", - "grunt-contrib-qunit": "~0.2.0", - "grunt-contrib-connect": "~0.1.2", - "grunt-contrib-watch": "~0.2.0", - "grunt-contrib-clean": "~0.4.0", + "grunt": "~0.4.1", + "grunt-contrib-compress": "~0.5.2", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-jshint": "~0.7.2", + "grunt-contrib-uglify": "~0.2.7", + "grunt-contrib-qunit": "~0.3.0", + "grunt-contrib-connect": "~0.5.0", + "grunt-contrib-watch": "~0.5.3", + "grunt-contrib-clean": "~0.5.0", "grunt-git-describe": "~2.0.0", - "grunt-text-replace": "~0.3.2" + "grunt-text-replace": "~0.3.9" }, "scripts": { "test": "grunt test" diff --git a/src/iiif1_1tilesource.js b/src/iiif1_1tilesource.js index 2f90355c..319aa0b1 100644 --- a/src/iiif1_1tilesource.js +++ b/src/iiif1_1tilesource.js @@ -51,7 +51,12 @@ $.IIIF1_1TileSource = function( options ){ 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 ) { var mf = -1; @@ -82,7 +87,6 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open "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#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 ); }, diff --git a/test/data/iiif_no_tiles.json b/test/data/iiif_no_tiles.json new file mode 100644 index 00000000..7f677b32 --- /dev/null +++ b/test/data/iiif_no_tiles.json @@ -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" +} + diff --git a/test/data/iiif_no_tiles/0,0,1024,850/128,107/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/128,107/0/native.jpg new file mode 100644 index 00000000..e0bacd02 Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/128,107/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/0,0,1024,850/16,14/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/16,14/0/native.jpg new file mode 100644 index 00000000..4cee30fa Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/16,14/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/0,0,1024,850/256,213/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/256,213/0/native.jpg new file mode 100644 index 00000000..6c8c5441 Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/256,213/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/0,0,1024,850/32,27/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/32,27/0/native.jpg new file mode 100644 index 00000000..f97752d8 Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/32,27/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/0,0,1024,850/512,425/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/512,425/0/native.jpg new file mode 100644 index 00000000..c3300449 Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/512,425/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/0,0,1024,850/64,54/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/64,54/0/native.jpg new file mode 100644 index 00000000..ad7f30c8 Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/64,54/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/0,0,1024,850/8,7/0/native.jpg b/test/data/iiif_no_tiles/0,0,1024,850/8,7/0/native.jpg new file mode 100644 index 00000000..893409b0 Binary files /dev/null and b/test/data/iiif_no_tiles/0,0,1024,850/8,7/0/native.jpg differ diff --git a/test/data/iiif_no_tiles/full/full/0/native.jpg b/test/data/iiif_no_tiles/full/full/0/native.jpg new file mode 100644 index 00000000..dcc1d22b Binary files /dev/null and b/test/data/iiif_no_tiles/full/full/0/native.jpg differ diff --git a/test/formats.js b/test/formats.js index e0915a5c..9cabf816 100644 --- a/test/formats.js +++ b/test/formats.js @@ -80,4 +80,9 @@ testOpen('iiif1_1.json'); }); + // ---------- + asyncTest('IIIF No Tiles', function() { + testOpen('iiif_no_tiles.json'); + }); + })();