Last modified: 2014-09-10 23:09:17 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 T5593, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 3593 - SVG client side rendering
SVG client side rendering
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Low enhancement with 20 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: accessibility, patch, patch-need-review
: 12623 20254 22391 38508 41771 (view as bug list)
Depends on:
Blocks: multimedia
  Show dependency treegraph
 
Reported: 2005-10-04 00:31 UTC by Helge Hielscher
Modified: 2014-09-10 23:09 UTC (History)
29 users (show)

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


Attachments
A hacky patch to enable svg transport in v1.20.2 (1.69 KB, patch)
2013-02-08 20:54 UTC, Joe ST
Details

Description Helge Hielscher 2005-10-04 00:31:38 UTC
Please add an option to allow client side SVG rendering.
Comment 1 David Benbennick 2005-12-13 03:13:50 UTC
I just upgraded to Firefox 1.5, and now it just knows how to display SVG (I
didn't have to configure anything).  So I agree, an option for client-side SVG
rendering would be nice.  Maybe with an option like "send SVG files to the
browser directly when they are at most FOO bytes", because I'd still rather have
overly large SVG files rendered by MediaWiki at the server.
Comment 2 ThePeritus 2006-07-18 21:13:47 UTC
http://de.wikipedia.org/wiki/Benutzer:ThePeritus/monobook.js <- test it.

Sadly, it seems like most of the SVGs need viewBox-correction :(
Comment 3 ThePeritus 2006-07-18 22:34:37 UTC
ok, svg:svg/@viewBox is ok, @width/@height seems more the problem (for firefox ?!):

http://commons.wikimedia.org/wiki/Image:SVG_Coordinates.svg is shown (as thumb)
with scrollbar, 
http://commons.wikimedia.org/wiki/Image:SVG_Coordinates_100percent.svg works
like a charm ;)

As i probably 'll try to improve the monobook.js, here is a frozen version, that
works with FF1.5:
http://de.wikipedia.org/w/index.php?title=Benutzer:ThePeritus/monobook.js&oldid=19137854
Comment 4 ThePeritus 2006-07-19 14:59:40 UTC
Here is the corresponding mozilla-bug:
http://bugzilla.wikimedia.org/show_bug.cgi?id=3593

I think the workaround for this is ripping the svg:svg/@[svg:width|svg:height]
on "thumbed" svgs with a simple xsl-stylesheet
Comment 5 denelson83 2006-09-04 08:59:32 UTC
You know, if MediaWiki allows clients to render SVGs on their own, then that
could allow embedding hyperlinks right into SVG images.

http://www.w3.org/TR/SVG11/linking.html
Comment 6 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-09-04 14:13:52 UTC
We'd probably want to strip those, then, at least for the moment (see also bug
1227).
Comment 7 Ruud Steltenpool 2007-10-03 14:08:51 UTC
Client-side SVG rendering would be a great OPTION (default to OFF, so discussion can be split from development).
Add in PNG fallback.

At a later moment i wouldn't mind switching the default ON
Comment 8 Brion Vibber 2007-10-03 14:46:30 UTC
Note that highly detailed SVG files can end up being very large, often much larger than a PNG rendering at suitable inline resolution. It would be wise to autodetect and only send the SVG if it's smaller than the PNG rendering.

Automatically gzipping the filtered SVG should also help here, but only by a limited factor.

As an example, the Florida state map on http://en.wikipedia.org/wiki/Pinellas_County%2C_Florida takes up:

Raw SVG:    317,316 bytes
gzip'd SVG: 109,288 bytes
200px PNG:   18,915 bytes

Or a more extreme example, the detailed county map:

Raw SVG:    3,900,442 bytes
gzip'd SVG: 1,118,953 bytes
300px PNG:     96,384 bytes


Sending SVGs may be a win for bandwidth on simpler images such as some icons such as http://commons.wikimedia.org/wiki/Image:PD-icon.svg ... but these tend to be small as PNGs as well.
Comment 9 Ruud Steltenpool 2007-10-03 14:53:12 UTC
Putting some limit in would be wise indeed.

If saving bandwidth was the only (possible) win of SVG, i wouldn't care much.
It's all the different 'semantic' (or re-use) properties that makes SVG so interesting.
That's why i keep the SVG links page at http://svg.startpagina.nl :-)
Comment 10 Brion Vibber 2008-01-14 23:53:40 UTC
*** Bug 12623 has been marked as a duplicate of this bug. ***
Comment 11 jonathan chetwynd 2008-01-15 07:28:23 UTC
#9 Ruud has mentioned the benefits in respect of labelling and repurposing are
significant and there is also the matter of css and animation.

one simple example for each:

1   labelling:

http://commons.wikimedia.org/wiki/Category:Weather_symbols

currently pngs are being served without 'alt' content, and the title content is
merely the local uri of the svg file.
it is unlikely that these are of much benefit to users who either have images
switched off, or are mousing over the graphics searching for relevant
information.

whereas the svg file has appropriate title content in the file.

the W3C Web Accessibility Initiative's Web Content Accessibility Guidelines and
W3C SVG specification have further information regarding this.

2    css and animation

http://peepo.co.uk/temp/moulin/moulin.svg

it's not clear how png provides any suitable representation for this example

3    repurposing

http://commons.wikimedia.org/wiki/Category:Weather_symbols

it should be apparent that much of the code is repeated throughout these examples.
it is relatively simple to change the colour of any part of an svg with a text,
or other editor, the same cannot be said for png gif or jpg

--

#8 bandwidth can be considered a side issue, a cap of say 2Mb similar to email
and possibly under user control, could be set.

in the two years since this bug was filed native browser support for SVG has
developed well, though not yet complete.
Comment 12 jonathan chetwynd 2008-01-15 09:24:38 UTC
further to #11 it seems to me that it is part of the wikipedia philosophy not to interfere with authors posts, where legal etc.
so SVG should be sent as is.

2 further mmore complex examples use the mouse or keyboard to explore

1 sound and text in a variety of languages (dependent on users system language) displayed on event, using CSS only 
http://www.peepo.co.uk

2 svg with feeds embedded, requires javascript enabled
http://peepo.getmyip.com/~JonathanChetwynd/zanadu.svg

neither would be well represented by png.

iirc there are a large number of medical and scientific diagrams of a similar nature
Comment 13 Michael Daly 2008-01-15 15:33:46 UTC
No mention so far of the fact that SVG can contain scripts which may be nasty if from a psychopathic spammer etc.  Should scripts be disabled or is it caveat emptor?
Comment 14 Brion Vibber 2008-01-16 03:08:20 UTC
Scripts are forbidden for safety, which pretty much destroys animation or interactive features.

A 10x or 20x increase in bandwidth (and therefore cost) pretty much demolishes remaining alleged advantages for our purposes for now. This remains a very low-priority, might-be-neat-someday issue.
Comment 15 Daniel Friesen 2008-01-16 06:22:50 UTC
I'd also have to add how differently rendering engines render svg images.

There are many SVG images which rsvg, ImageMagic, and Inkscape will render differently. And it's a whole different level for clients rending images. So one image that someone may see in some way on one browser because it's png rendered from say Inkscape, may look completely different from someone using another browser using client rendered svg's.

Think CSS browser-incompatibility issues... And multiply it 1000x fold.


Not to mention that while there are browsers which do have good support for SVG, that is primarily support for rendering a svg on it's own, many of those browsers may not actually be as good at rendering a svg inline without issues, last time I heard.
Comment 16 jonathan chetwynd 2008-01-16 07:35:46 UTC
#14 

brion,

this is outrageous, you appear to neither know the SVG specs, nor be looking at the examples given in the specs.

animation and interactivity do not require script, as shown in the examples given.
the animation is known as declarative.
the bandwidth increase is generally notional except for rare very large files.

#15 Dan, please point to specific examples, rather than just making unsupported assertions.
if you do have specific examples, how is it possible to decide which rendering is the correct one to render as a png? there are indeed cases, however they are relatively rare.
Comment 17 jonathan chetwynd 2008-01-16 07:42:24 UTC
#14

Brion,

for an indroduction to SVG animation and interactivity without script please try SMIL and the examples here:

http://www.kevlindev.com/tutorials/basics/animation/svg_smil/index.htm
http://www.kevlindev.com/tutorials/basics/events/mouse/svg_smil/index.htm

whilst it is true that declarative animation is not broadly supported yet, interactivity and CSS are, which provides many opportunities beyond png.
Comment 18 Alvaro 2008-12-08 18:54:31 UTC
I think sending embedded SVG directly to clients is a *must*. There could be a quick check for a compatible browser and if the user is using an old browser, OK, fallback to a rasterised PNG. If you want this behavior could be enabled in the user preferences panel (I would personally enable it by default but...).

BTW, wikipedia contains lots of SVGs, and when diagrams are uploaded as PNG (or worse JPEG) they insert a warning "This image should be recreated using vector graphics as an SVG file" (see http://en.wikipedia.org/wiki/Image:OO-historie.jpg). Why do they do that if after all they're sending clients only pixels, pixels and more pixels?

The reason for SVG is not only size (which may sometimes be big), it is its vector nature (vs raster). You can print in high quality, you can zoom in the page with Ctrl+Wheel and its always smooth. And also, client rendering can be better than the generated PNGs: see http://en.wikipedia.org/wiki/Singleton_pattern for example: the one generated is wrong while FF and Chrome display fine.
Comment 19 Daniel Friesen 2008-12-08 19:11:37 UTC
(In reply to comment #18)
> I think sending embedded SVG directly to clients is a *must*. There could be a
> quick check for a compatible browser and if the user is using an old browser,
> OK, fallback to a rasterised PNG. If you want this behavior could be enabled in
> the user preferences panel (I would personally enable it by default but...).
> 
> BTW, wikipedia contains lots of SVGs, and when diagrams are uploaded as PNG (or
> worse JPEG) they insert a warning "This image should be recreated using vector
> graphics as an SVG file" (see
> http://en.wikipedia.org/wiki/Image:OO-historie.jpg). Why do they do that if
> after all they're sending clients only pixels, pixels and more pixels?
> 
> The reason for SVG is not only size (which may sometimes be big), it is its
> vector nature (vs raster). You can print in high quality, you can zoom in the
> page with Ctrl+Wheel and its always smooth. And also, client rendering can be
> better than the generated PNGs: see
> http://en.wikipedia.org/wiki/Singleton_pattern for example: the one generated
> is wrong while FF and Chrome display fine.
> 

Uhm, not to burst your bubble. But .svg images are not uploaded so that clients can zoom in the page. They are uploaded because thumbnails can be made in any size you want without loosing quality. That is independent of whether the browser or server does the rasterizing of the image.

Now as for testing for browser support. There are multiple issues there:
A) Testing for support is unreliable. We don't have a nice list of what supports what, and even if we did that changes, and support isn't always the best in older stuff. Obscure browsers which support it may end up off the list, while common browsers that don't support it as well may end up on that list. But because of the changing nature it's an unreliable feature, since it'll take part of a year between releases of MediaWiki for that list to change, and even then people don't always jump to updating right away.
B) Support is also independent of the browser. You can get IE to work with SVG images if you install a plugin, but I don't believe that's something we can reliably test server side.
C) Testing clients for .svg support and conditionally sending a .png or .svg will break the caching model. It won't be possible to properly cache a squid response with that kind of test, and will require extra server work that isn't necessary.
Comment 20 Daniel Friesen 2008-12-08 19:13:33 UTC
Oh right... I forgot the last bit.

While you have found a buggy svg that works in browsers but not on the server. That can easily be fixed by fixing the server-side rasterizer. However, there are plenty more svg images that work fine server side, but are unreliable in rendering browser side. That cannot be fixed by updating the rasterizer or fixing the svg to work properly server-side.
Comment 21 Brion Vibber 2008-12-08 21:56:15 UTC
While it would be interesting to have the ability to do inline SVG embedding, we would likely not enable it on Wikimedia sites due to all the above concerns -- certainly not based on any auto-detection. As a general case, it's just not worth the pain of the unreliable, inconsistent client-side support.
Comment 22 Martin Fischer 2008-12-09 12:39:41 UTC
So, every client-side support today is much better than librsvg.
Comment 23 Alvaro 2008-12-09 21:31:01 UTC
Well, thanks, there's an explanation for everything.

What about letting registered users decide (at their own risk) if they want to enable it in their personal settings?

I really think SVG has a place in the Web and in wikimedia-based wikis in particular beyond making good thumbnails of any size.
Comment 24 Chad H. 2009-08-15 12:39:56 UTC
*** Bug 20254 has been marked as a duplicate of this bug. ***
Comment 25 Chad H. 2010-02-05 11:24:25 UTC
*** Bug 22391 has been marked as a duplicate of this bug. ***
Comment 26 Robert Fleming 2011-04-12 16:53:59 UTC
This seems like it would be pretty straightforward to do.  It seems like it's not getting done for reasons specific to Wikipedia and other public wikis.  My application is an enterprise setting, where browsers are controlled, and malice is pretty much non-existent.

Would you be able to provide and pointers as to how you *would* do this if you did do it?  Could it be an extension, or must it involve core code changes?

I've written several extensions, so I'm somewhat familiar with the code/architecture.

Thanks.
Comment 27 Bawolff (Brian Wolff) 2011-04-13 02:09:50 UTC
(In reply to comment #26)
> 
> Would you be able to provide and pointers as to how you *would* do this if you
> did do it?  Could it be an extension, or must it involve core code changes?
> 

Probably as a custom media handler extension. For example compare what you want to do to the oggHandler extension which when embedding an ogg (video or audio) file, it inserts a button that when you click on it starts a java based player.
Comment 28 Bawolff (Brian Wolff) 2012-07-23 12:22:17 UTC
*** Bug 38508 has been marked as a duplicate of this bug. ***
Comment 29 larson 2013-02-08 20:43:51 UTC
Would love to have SVG rendered natively in the client. It's 2013, the support is there — Brion's 4-year-old comment in that regard notwithstanding.  If you don't want to enable it on Wikimedia sites, fine, you don't have to.  For my site, I'd rather have the file downloaded and cached once, than fetching multiple rasterized resizings of it.
Comment 30 Jesús Martínez Novo (Ciencia Al Poder) 2013-02-08 20:50:13 UTC
*** Bug 41771 has been marked as a duplicate of this bug. ***
Comment 31 Joe ST 2013-02-08 20:54:44 UTC
Created attachment 11758 [details]
A hacky patch to enable svg transport in v1.20.2

originally attached to #41771
Comment 32 Andre Klapper 2013-04-11 13:00:31 UTC
Thanks for your patch!
You (anybody here) are welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit this as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial
Putting your branch in Git makes it easier to review it quickly.
Comment 33 Marco 2013-10-25 10:40:44 UTC
(In reply to comment #31)
> Created attachment 11758 [details]
> A hacky patch to enable svg transport in v1.20.2
> 
> originally attached to #41771

This does not attack the issue with overly large SVG files containing a lot of details, as far as I can see.
Please make sure that large SVGs are thumbnailed to PNG.
Comment 34 Cliff Berg 2013-12-15 17:49:15 UTC
As a user and administrator of a WikiMedia instance, that is used for collaboration, the most important use of SVG is to enable teams to upload images that others can then edit. Rasterized formats fail in this regard. Having embedded diagrams in wiki pages is crucial for nearly all collaborative applications. SVG finally, finally provides a solution for that.
Comment 35 Eduard Braun 2014-03-01 15:26:06 UTC
Since it isn't linked yet (hope I didn't over-read it):
The extension "NativeSvgHandler" provides this functionality

(see https://www.mediawiki.org/wiki/Extension:NativeSvgHandler)
Comment 36 Joe ST 2014-04-08 10:30:33 UTC
The patch still works on v1.22.5 tho the lines may be different.
Comment 37 C. Scott Ananian 2014-05-29 20:01:33 UTC
Note that the 'lang' option won't work for client-side SVG rendering; see bug 58920.

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


Navigation
Links