Support IIIF images with no Image API service#563
Conversation
|
Whoops... crossed wires. I just published 7.3.0, so this will have to go into 7.3.1. I upgraded the dependency so you can remove that from your PR. |
|
I think you will also need to build the release versions again after the bump to resolve the conflict. The only hesitation I have is that you're using the full image as the thumbnails. I'm not sure what the answer is to that, but that's a significant load if you're downloading all the full resolution images for that purpose. |
Upgrade to elm-iiif 2.0.0, which decodes painting-annotation image
bodies that omit `service` (a plain static image, valid per the
Presentation 3 spec) instead of rejecting the manifest outright.
Thread that through diva.js's own pipeline: PageImage now carries an
isStatic flag, and the tileSourcesUpdated/filterPreviewUpdated ports
pass it to the viewer so OpenSeadragon opens static images as
{type: "image", url} instead of trying to fetch them as an info.json
tile pyramid. Also skip building an Image-API thumbnail derivative URL
for static images, since there's no Image API to request it from.
Add an elm-test suite covering both the static-image and
Image-API-backed cases, and a CI workflow to run it.
7.3.0 was already published with the minimal elm-iiif bump alone; this patch adds the OpenSeadragon-side plumbing so static images actually render (not just decode without crashing).
753cb87 to
59237bc
Compare
|
@tacman any ideas about the thumbnails? Do you know what UV or Mirardor does in this case? |
|
I use imgproxy.net for thumbnails. iiif allows sending an array of different-size images, many sites provide thumbnails simply as an extra file, so i think finding an iiif manifest with thumbnails will work. |
When canvases define their own thumbnails, prefer those over constructing one, or using a full image. Refs DDMAL/diva.js#563
|
I reworked this PR into a new set of changes. For thumbnails, canvases now support the thumbnail property so you can set your imgproxy URL as a thumbnail on the canvas, instead of downloading the whole file. I've tested it and it seems to work. I'm going to close this PR unmerged because it's been superceded, but I've mentioned you as co-author on the commit message and in the release. Thanks again! |
Fixes #562.
Problem
v7 rejects otherwise-valid IIIF Presentation 3 manifests whose painting-annotation image bodies have no
service(a plain static image with no Image API), reporting "Invalid IIIF response body." Static images without an Image API service are explicitly valid per the Presentation 3 spec.Note on scope
developalready picked up therism-digital/elm-iiif→2.0.0bump alone (832b8b9, released as7.3.0). That's necessary but not sufficient: it stops the manifest decode from failing, but the image still doesn't render — OpenSeadragon gets handed a bare static-image URL as atileSourcestring, tries to fetch it and parse it as aninfo.json/tile-descriptor document, and fails withNo TileSource was able to open .... I verified this ondevelopas it stands today (build + browser check) before writing this PR.This PR rebases on top of that and adds the rest: telling the viewer when a tile source is a plain static image so it opens it correctly.
Fix
isStaticflag through diva.js's own model/view pipeline:PageImagegainsisStatic(Truewhenimage.serviceis empty).tileSourcesUpdatedandfilterPreviewUpdatedElm ports carry that flag alongside the URL.viewer-element.ts/diva.tsopen static images as{type: "image", url}(OpenSeadragon's plain-image source) instead of treating the URL as aninfo.jsontile-pyramid endpoint.package.jsonto7.3.1(7.3.0is already published).Tests
Added
tests/ModelTest.elm(run viayarn test, usingelm-test-rs) covering:service→ decodes, andmanifestToPagesproduces aPageImageflaggedisStaticwith the raw image URL as its tile source.service→ still resolves to aninfo.jsontile source (no regression for the common case).Also added a
test.ymlCI workflow to runyarn testandmake build build-devon push/PR.Manual verification
Built (
make build build-dev) and loadedtesting/index.htmlin a browser, comparing currentdevelopagainst this branch:developas-is (elm-iiif 2.0.0 alone): a static-image manifest decodes and its thumbnail renders, but the main viewer stays blank withNo TileSource was able to open ...console errors.info.jsonrequest.