Last modified: 2006-03-02 02:55:30 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 5137 - Problem fetching the image size of SVG files created by Visio 2003
Problem fetching the image size of SVG files created by Visio 2003
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-03-01 13:02 UTC by Sasha G
Modified: 2006-03-02 02:55 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

SVG file created by Visio 2003 (1.23 KB, text/xml)
2006-03-01 13:04 UTC, Sasha G

Description Sasha G 2006-03-01 13:02:33 UTC
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|%|)$/'
Comment 1 Sasha G 2006-03-01 13:04:13 UTC
Created attachment 1425 [details]
SVG file created by Visio 2003
Comment 2 Brion Vibber 2006-03-02 02:55:30 UTC
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) {
  string(3) "SVG"
  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.

Note You need to log in before you can comment on or make changes to this bug.