Merge pull request #1656 from buda-base/fix-1655

add support for iiif preferredFormats
This commit is contained in:
Ian Gilman 2019-06-24 09:53:24 -07:00 committed by GitHub
commit 079ae0fdcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,11 +202,19 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
options['@context'] = "http://iiif.io/api/image/1.0/context.json";
options['@id'] = url.replace('/info.xml', '');
return options;
} else if ( !data['@context'] ) {
data['@context'] = 'http://iiif.io/api/image/1.0/context.json';
data['@id'] = url.replace('/info.json', '');
return data;
} else {
if ( !data['@context'] ) {
data['@context'] = 'http://iiif.io/api/image/1.0/context.json';
data['@id'] = url.replace('/info.json', '');
}
if(data.preferredFormats) {
for (var f = 0; f < data.preferredFormats.length; f++ ) {
if ( OpenSeadragon.imageFormatSupported(data.preferredFormats[f]) ) {
data.tileFormat = data.preferredFormats[f];
break;
}
}
}
return data;
}
},