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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T7137, the corresponding Phabricator task for complete and up-to-date bug report information.
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
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  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: ---


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

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) {
  [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.

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


Navigation
Links