openverse icon indicating copy to clipboard operation
openverse copied to clipboard

Add thumbnails to Wikimedia

Open krysal opened this issue 1 year ago • 4 comments

Problem

Related to #2442, we have seen tiff images coming from Wikimedia, so while that issue gets solved, we can also add thumbnails to these images and prevent situations where the browser can't show the image, like the following case:

https://openverse.org/image/3caf9d55-f9b3-471b-9ce2-926fdb07a0e4

Screenshot 2023-09-27 at 14-24-39 File France Rouen 16th century - Leaf from a Book of Hours- Adam and Eve and the Fall of Man (Prefatory Mini - 2001 79 a - Cleveland Museum of Art tif Openverse

Description

We can get the thumbnail of the width we want appending the param iiurlwidth=<desired_number> to the API endpoint, e.g: https://commons.wikimedia.org/w/api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo&iiprop=url|user|dimensions|extmetadata|mediatype|size&iiurlwidth=600

One possible issue with this is that the documentation says:

For performance reasons if this option is used, no more than 50 scaled images will be returned.

Our current batch limit is set to 250.

Additional context

Source: https://wmds-archive.toolforge.org/t/accessing-a-commons-thumbnail-via-wikidata/499/

krysal avatar Sep 28 '23 14:09 krysal