Page MenuHomePhabricator

thumbs of SVG images where only height parameter is specified do not get scaled up beyond their "normal" width
Closed, ResolvedPublic

Description

Author: a.d.bergi

Description:
Small SVG files embedded with [[File:foo.svg|x500px]] don't get enlarged. The png generator would work, but the wrong image is embedded: the one with the default size of the svg.
Examples would be [[File:AB-Rast.svg|x30px]] or [[File:AB-AS.svg|x30px]]. This is not reproducable with every image.


Version: 1.17.x
Severity: normal

Details

Reference
bz28940
TitleReferenceAuthorSource BranchDest Branch
Update function-schemata sub-module to HEAD (9abc7c2)repos/abstract-wiki/wikifunctions/wikilambda-cli!8jforrestersync-function-schematamain
Update function-schemata sub-module to HEAD (9abc7c2)repos/abstract-wiki/wikifunctions/function-evaluator!17jforrestersync-function-schematamain
Update function-schemata sub-module to HEAD (9abc7c2)repos/abstract-wiki/wikifunctions/function-orchestrator!22jforrestersync-function-schematamain
Remove Z13 references, we've abandoned itrepos/abstract-wiki/wikifunctions/function-schemata!11jforresterT309409main
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:29 PM
bzimport set Reference to bz28940.

Caused because if the width is unspecified, it is taken to be the normal width of the image. This makes sense for bitmap images where we don't want to scale beyond the natural width of the image. For vectorized images, less so.

Created attachment 8530
Patch to make max height of an svg image only depend on $wgSVGMaxSize

Here's a patch that changes it so the max width for vectorized images, when only the height is specified is $wgSVGMaxSize instead of being the actual width of the image.

Not sure if this is the right place to put the check (but i guess where the current check already is). Also it kind of uses $wgSVGMaxSize in a more generic way (for all vectorized images, not just svgs) than the variable name would suggest. Something doesn't feel quite right about it.

Anyways, I'm not sure if this patch is "right". I might commit it later when I'm not as tired.

Attached:

Your weary feelings are not out of place. This part should not really be in Linker.php as far as I'm concerned. We should do parameter normalization in the imagehandlers (and I actually just added this for OggHandler, not yet committed).

I'll try and look further into this, it's a tad of a mess it seems.

(In reply to comment #3)

I'll try and look further into this, it's a tad of a mess it seems.

In the meantime, Bawolff, could you apply your patch?

Bryan.TongMinh wrote:

I agree with Mark, it should be good enough for now.

However, as TheDJ said, this code is a mess and should eventually be rewritten.

Applied in r88129. I'll open another bug about the whole Linker code thing.

Before I forget, to anyone affected by this bug - the work around is to specify a really really big width. The intended effect could be accomplished with [[File:AB-Rast.svg|9999999999999999x30px]].

Gilles raised the priority of this task from High to Unbreak Now!.Dec 4 2014, 10:19 AM
Gilles added a project: Multimedia.
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to High.Dec 4 2014, 11:20 AM