Wikimedia

Fix SVG sizing in MediaWiki's MediaViewer extension

MediaViewer is the image viewer JavaScript library used on Wikimedia sites. Thumbnails are available in a certain set of predefined sizes; when the user clicks on a thumbnail in an article, MediaViewer selects the size that can best fit the browser viewport, and displays it along with other information.

Images are not available in any size that's larger the original file, so if that was smaller than the viewport, it won't be fully filled. Vector images should be an exception from this, as they can be arbitrarily magnified without any quality loss, so it should always be possible to fit them to the viewport, but MediaViewer just handles them as any other image, never using a size larger than the nominal size of the original SVG (even though SVG nominal sizes are pretty much meaningless). The bug tracker has more details and examples: T71237.

Please fix this. The fix is trivial code-wise as SVG handling was built into the code and then disabled (just search for "SVG" in mmv.js) but you'll have to set up a test environment and make sure there are no unexpected side effects and non-vector files too small for the viewport still behave correctly.

You are expected to provide a patch in Wikimedia Gerrit. See https://www.mediawiki.org/wiki/Gerrit/Tutorial for how to set up Git and Gerrit.

Task tags

  • javascript

Students who completed this task

Jacob (Flutters)

Task type

  • code Code
close

2018