WordPress/openverse-api

Use smaller image for generating thumbnails for SMK

stacimc opened this issue · 4 comments

Description

Images linked in the image_urls for the SMK provider are all ~2MB. These are large enough to overload our thumbnail service. Some of these requests timeout, such that the frontend falls back to downloading the entire full image. The result is unacceptable load times.

We should update the API to detect the SMK provider and modify the URL used for thumbnail generation.

image_url that we receive has the form: https://iip.smk.dk/iiif/jp2/KKSgb5100_34.TIF.jp2/full/!2048,/0/default.jpg Note the2048.

The modified URL should be identical, except for a reduced filesize: https://iip.smk.dk/iiif/jp2/KKSgb5100_34.TIF.jp2/full/!400,/0/default.jpg

Additional context

This change should be a temporary quick-fix that will allow us to re-enable the SMK provider, so we can make these images available again as soon as possible.

In the longer term, https://github.com/WordPress/openverse-catalog/issues/698 tracks updating the provider to provide links to smaller files for the purpose of thumbnail generation.

Resolution

  • 🙋 I would be interested in resolving this bug.

SMK confirmed that the smaller the image, the faster the endpoint is. So we could use the https://iip.smk.dk/iiif/jp2/KKSgb5100_34.TIF.jp2/full/!512,/0/default.jpg 512px size for our thumbnails.

Hey @zackkrida is this issue still open? I would like to contribute to this issue.

@Hussain0520 that would be fantastic. Yes, this issue is still open. This would essentially be a 'hotfix' to our API /thumbs endpoint that checks when the provider is smk and rewrites the image url to use the 512 width instead of the 2048.

I assume we want to do this work here:

def thumbnail(self, request, *_, **__):
but @stacimc or @krysal can confirm.

Please visit our #openverse channel in the Make WP slack if you need any real-time help, otherwise you can leave thoughts here or on your PR. Thank you!

@Hussain0520 are you working on this ticket? This is a high priority ticket so we would appreciate if you could let us know if you would not be able to work on that.