Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail helper doesn't handle 'Choice' resources correctly #7

Open
jbaiter opened this issue Jul 8, 2022 · 1 comment
Open

Thumbnail helper doesn't handle 'Choice' resources correctly #7

jbaiter opened this issue Jul 8, 2022 · 1 comment

Comments

@jbaiter
Copy link
Contributor

jbaiter commented Jul 8, 2022

When attempting to load the thumbnail for the Manifest at https://iiif.io/api/cookbook/recipe/0033-choice/manifest.json, getBestThumbnailAtSize is unable to find one:
https://codesandbox.io/s/vault-helpers-forked-lwux3g

I assume it's due to the fact that the Manifest's sole Canvas has an Annotation with a Choice body that has two different images.

Looking through the code, it seems to me that getBestThumbnailAtSize is missing a level of recursion. When it encounters an Annotation, it assumes that the first body item is an Image that can be passed to imageServiceLoader.getThumbnailFromResource: https://github.com/IIIF-Commons/vault-helpers/blob/8a14efa1fdaf2e31f87a926e515efb7bf3631bc3/src/thumbnail.ts#L72-L88

I think it should instead check the type of the body item and recurse if it's a Choice, so it will hit the branch at https://github.com/IIIF-Commons/vault-helpers/blob/8a14efa1fdaf2e31f87a926e515efb7bf3631bc3/src/thumbnail.ts#L113-L117, which should do the right thing.

@stephenwf
Copy link
Member

Ah I see the problem, yes so maybe if it created a list of the content resources first, then it could pick from those. I think the general problem is that we need to check all possibilities before being able to choose the best one for a thumbnail.

There are a load of shortcuts, but I had hoped that this thumbnail helper would be a definitive way to always find a thumbnail if one existed. Will have a look over the weekend

@stephenwf stephenwf transferred this issue from IIIF-Commons/vault-helpers Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants