[openstreetmap/openstreetmap-website] Wikidata preview should request a standard thumbnail width (Issue #7027)
Minh Nguyễn
notifications at github.com
Thu Apr 23 02:05:45 UTC 2026
1ec5 created an issue (openstreetmap/openstreetmap-website#7027)
As of #6127, when you click the Wikidata icon beside a `wikidata=*` or `*:wikidata=*` value in the data browser, we request a 128-pixel-wide image from the Special:Redirect handler on Wikimedia Commons:
https://github.com/openstreetmap/openstreetmap-website/blob/d6136bb25a859d30721324b4f23bbcc371afc3c2/app/assets/javascripts/index/element.js#L123
We should request a 120-pixel-wide image instead.
Recently, the Wikimedia Foundation has been [curtailing access](https://phabricator.wikimedia.org/T414805) to thumbnails that aren’t one of [the standard sizes](https://www.mediawiki.org/wiki/Common_thumbnail_sizes). This request succeeds but returns an image at the next available width, 250 pixels, which we then scale down based on a height of 32 pixels. It’s a bit wasteful to get the larger image, and it’s unclear if even requests for the nonstandard size will result in throttling in the future.
https://github.com/openstreetmap/openstreetmap-website/pull/6127#discussion_r2183521985 proposed switching to the Wikimedia Commons Action API, which gives us more control over the requested image. For example, [this request](https://commons.wikimedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=imageinfo&titles=File%3ADHL%20Group%2006.2023.svg&formatversion=2&iiprop=url%7Csize&iiurlheight=32) returns a thumbnail that’s already 32 pixels tall, without any need for further downscaling. We also won’t need the workaround in #6202 to prevent mobile browsers from redirecting the page.
In order to use the Action API, we’d need to write an asynchronous function to make the request and parse the response, rather than relying on an `<img>` tag to handle a redirect automatically.
/ref openstreetmap/operations#1356
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/7027
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/7027 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260422/f8e0c3b3/attachment.htm>
More information about the rails-dev
mailing list