openverse
openverse copied to clipboard
Add thumbnails to Wikimedia
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
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/