Hovercard images appear to always be loaded at 1x density; on a 'Retina'/hi-DPI display this leads to the preview images being a bit blurry. This is especially noticeable on diagrams/flags/maps/etc such in as the below screenshot, but is visible on photos as well.
Description
Details
Related Objects
Event Timeline
Change 208515 had a related patch set uploaded (by Brion VIBBER):
Hi-DPI/Retina support for hovercard images
Change 208820 had a related patch set uploaded (by Brion VIBBER):
Provide $.bracketedDevicePixelRatio convenience function
I'm concerned (maybe incorrectly) that this is being done on a case by case basis and anyone developing in MediaWiki shouldn't have to think about this. Can't we have a JavaScript and PHP API to do this? e.g. mw.util.getImage() / File()->getImage()
It seems to be any image generated on the server or client (maybe the latter via oojs or oojs ui) via a standard API (e.g. mw.util.getImageElement / file->getImage() should have data attributes and apply them for hdpi support..
Jon -- that's a good concern to have. I'll look into a cleaner high-level solution for JS stuff...
On PHP side, things using the standard wiki methods of image output should already give the 1/1.5/2x densities in srcset automatically, but I do seem to recall that doesn't cover all output cases. (At least early on, galleries and a couple other places didn't trigger the multiple resolutions.)
Change 208820 merged by jenkins-bot:
Provide $.bracketedDevicePixelRatio convenience function