- T44725: Multimedia file format support (tracking)
- Blocked By
- T131012: SVGs without XML prolog (<?xml ... ?>) served with Content-Type text/html from upload.wikimedia.org
T134490: Create minified SVG output in thumbnail space to serve for <img>s
T134482: Beta feature for opt-in client side SVG rendering
T134455: Add experimental option for direct SVG output via srcset
T134415: Provide tools for contributors to optimize SVG files
T134409: Evaluate compatibility of <picture> for browser SVG rendering compatibility
T134410: Evaluate SVG rendering compatibility in browsers
T134407: Provide a way to reference fonts for client-side SVG rendering
T134408: Thumbnail-like rendering of localized SVGs for client-side rendering
(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.
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.
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.
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.
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.
(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.
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.
Thanks for your patch!
You (anybody here) are welcome to use Developer access
to submit this as a Git branch directly into Gerrit:
Putting your branch in Git makes it easier to review it quickly.
(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.
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.
I mean this would be a perfect solution for MediaWiki and an high quality boost! (because of the bad old libRSVG and very poor support [http://git.gnome.org/browse/librsvg/stats/?period=y&ofs=-1])
As far as I can see this patch just adds a boolean whether to serve SVG or not. It does not take into account browser support, OS (desktop or mobile) and the size of the SVG (some SVG are several MB!)?
While it may work fairly well on private wikis, it surely won't make it into the WMF release as-is.
Anyway, adding a user preference sounds nice.
Yes, that's why it's marked 'WIP'. It should support more configuration options and provide PNG fallbacks when possible.
I see unresolved security issues since SVG may contain JS script and references to external webpages. There must be some sort of filter for that kind of stuff otherwise it is a huge entry point for hackers.
I have a last strong idea/suggestion (to the only hard contra argument bad SVG): How about setting up the Reviewer system (Wikipedia:Flagged revisions/Sighted versions) for SVG files!? As this system works very good in the German WP for articles.
So we could maybe add a new user group SVGreviewer (for native client rendering)!?
Edit: On Commons that would include the similar maintain templates: invalidSVG and badSVG
Sorry I really don't get your comment, I mean this fully related to this topic (and I see also no concrete relation to Help:SVG). Without any similar feature there will be never a client side rendering.
Maybe a size check is the minimum similar feature (what I meant).
What I mean with "bad SVG for clients" is this for example:
I don't want wiki users to be responsible for ensuring that svgs do not contain malicious js. Site security is not something that should be up to individual users.
We will not do this feature, unless we are confident that our internal filter is sufficient to prevent malicious code in svgs (An alternative might be to have svgs in an entirely different domain, and shown via in iframe sandbox)
SVGs are already filtered for scripting security at upload time, and in Wikimedia production they are already served from a separate domain. Further, SVGs in <img> elements are already sandboxed by browsers and cannot run scripts (though if you load the same file directly of course it'll happily run scripts).
Change 182332 abandoned by Ricordisamoa:
[WIP] enable native client-side rendering of SVG images
I've rebased the change just in case someone wants to revive it, but I'm abandoning it as it was nothing more than a proof of concept. Ongoing work by Brion at T134482