Page MenuHomePhabricator

Problem fetching the image size of SVG files created by Visio 2003
Closed, DeclinedPublic

Description

Author: sashagim

Description:
In SVG files created by Visio 2003 the width/height of the image are specified
in inches, and the values are specified in floating numbers. The function
wfScaleSVGUnit on the other hand, which is responsible for translating the
width/height strings which appear in the SVG file (and may be of various units)
doesn't support floating numbers. It therefore assumes that the values are in
pixels, thus returning an invalid value (usually extremely small - few pixels).

The fix is to replace the regular expression which is used by wfScaleSVGUnit on
line 1663 to '/^(\\d+\\.*\\d*)\\s*(em|ex|px|pt|pc|cm|mm|in|%|)$/'


Version: unspecified
Severity: normal
OS: Windows XP
Platform: PC

Details

Reference
bz5137

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:08 PM
bzimport set Reference to bz5137.
bzimport added a subscriber: Unknown Object (MLST).

sashagim wrote:

SVG file created by Visio 2003

Attached:

Seems to work fine; wfScaleSVGUnit already expects and works with floats.

The given file contains:
width="1.2011in" height="1.2011in"

and we get back what appears to be the correct size given the SVG definition of
1in as 90.0 units:

return wfGetSVGSize("/Users/brion/Desktop/shape.svg.xml");

array(4) {

[0]=>
float(108)
[1]=>
float(108)
[2]=>
string(3) "SVG"
[3]=>
string(24) "width="108" height="108""

}

However it can't be uploaded to MediaWiki; I think the <script> element is
triggering the standard HTML safety filter. That would be a separate bug
if you wish to open a report for it.