Page MenuHomePhabricator

Default "Other resolutions" options do not make sense for SVG
Closed, ResolvedPublic

Description

Author: mcdevitd

Description:
MediaWiki's default for generating "Other resolutions" options for PNG previews for SVG files seems to be based on the same logic as for other file formats (offer small- and medium-resolution versions smaller than the full resolution), when they can actually be rendered as PNG previews with resolutions much larger than the original SVG file's resolution. de.wp, en.wp, and Commons already have JS that under the mostly useless"Other resolutions" line generates a line that says "This image rendered as PNG in other sizes: 200px, 500px, 1000px, 2000px." See https://en.wikipedia.org/wiki/MediaWiki_talk:Common.js/Archive_17#SVG_files:_links_to_rendered_PNG_images

However, since these larger sizes are not offered by default by MediaWiki, it creates a confusing situation where some projects then have redundant lists of options offering previews of different resolutions, and all other MediaWiki projects are stuck with non-ideal "Other resolutions" options.

Compare https://commons.wikimedia.org/wiki/File:Meuble_h%C3%A9raldique_Crosse.svg (redundancy) and https://en.wiktionary.org/wiki/File:Meuble_h%C3%A9raldique_Crosse.svg (non-ideal options)

This is particularly problematic when the original SVG (as many are) has a resolution too small for MediaWiki to generate "Other resolutions" options, and then the user gets no PNG preview options at all.

Compare https://commons.wikimedia.org/wiki/File:Svg_example1.svg and https://en.wiktionary.org/wiki/File:Svg_example1.svg (nothing)

Ideally, SVG images should give PNG preview options like "200px, 500px, 1000px, 2000px" by default, even for very small SVG originals.


Version: 1.23.0
Severity: minor

Details

Reference
bz56508

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:32 AM
bzimport set Reference to bz56508.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Nov 2 2013, 6:36 AM
saper added a comment.Nov 4 2013, 10:55 AM

I understand that one issue is that the preview size of SVG should be ignored here: 358 # Generate thumbnails or thumbnail links as needed...

(from includes/IncludePage.php):
359 $otherSizes = array();
360 foreach ( $thumbSizes as $size ) {
361 if ( $size[0] < $width_orig && $size[1] < $height_orig
362 && $size[0] != $width && $size[1] != $height )
363 {
364 $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] );
365 if ( $sizeLink ) {
366 $otherSizes[] = $sizeLink;
367 }
368 }

so we could remove "less that $width_orig, $height_orig" test here for SVG.

Regarding the list of offered sizes I am not sure but I think it is related to https://www.mediawiki.org/wiki/Manual:$wgImageLimits and user preferences; this setting can be tweaked, if necessary.

I agree, we should check isVectorized (or whatever the method is named) and only limit the sizes for raster images.

To clarify, you are just opposed to not returning the bigger than source sizes, you don't have any problems with the sizes offered in general (for big images)?

mcdevitd wrote:

I think generally the options offered in "Other resolutions" don't make a lot sense, but they make the least sense for SVGs, and for a slightly different reason. But yes, for high-resolution files, it can be really odd when the only options you get range just from very-low-resolution to less-than-half original resolution, while for smaller images, they are closer to quarter-, half-, and three-quarter-resolution previews. I thought that might be a separate bug report, though. :-)

(In reply to Dominic from comment #3)

I think generally the options offered in "Other resolutions" don't make a
lot sense, but they make the least sense for SVGs, and for a slightly
different reason. But yes, for high-resolution files, it can be really odd
when the only options you get range just from very-low-resolution to
less-than-half original resolution, while for smaller images, they are
closer to quarter-, half-, and three-quarter-resolution previews. I thought
that might be a separate bug report, though. :-)

Ok, I'm going to call this a dupe of bug 6834 which I just submitted a patch for. (That bug is that no sizes bigger than default size of svg is listed).

If you want the size choices to be different (e.g. Multiples of 10 instead of multiples of 80 or whatnot) please file a separate bug for that

  • This bug has been marked as a duplicate of bug 6834 ***
Gilles moved this task from Untriaged to Done on the Multimedia board.