At a bare minimum any SVG hosting project would have to involve some sort of SVG lint, to make sure that browser-incompatible SVG elements are not present, implement workarounds for browser-specific bugs, and check that there are no tags etc. The sheer size and complexity of even SVG 1.1 makes it non-trivial. One pragmatic approach to sanitize SVG may be to round-trip SVG -> PDF -> SVG via cairosvg and pdftocairo, though it may burn some CPU.
Ask HN:Whats the problem with SVG?
11–20 of 27 posts
Re: Ask HN:Whats the problem with SVG?
#12It's not hard. However, I'd note that IE didn't have built in support until 2011, and the first browser with native svg support was Konqueror in 2004, whereas gif and jpeg have been around for a lot longer. Isn't SVG just XML? I'd assume you could host it that way.
It's XML based, really only uses a different schema.
Re: Ask HN:Whats the problem with SVG?
#13Re: Ask HN:Whats the problem with SVG?
#14XML being XML, it's hard-to-impossible to host SVG without allowing people to store arbitrary XML on your service, which sooner or later is going to be abused.
If you really wanted to, you could pretty much make your own webpage run on the image hosting server.
Also, you could send a malicious script to someone hidden in a cute cat drawing, and it would look like it was the host's fault.
Re: Ask HN:Whats the problem with SVG?
#15Re: Ask HN:Whats the problem with SVG?
#16SVG implementations on browsers have historically been poor, though this is certainly improving. You'll hit many bugs and unsupported features. IE The worst problem may be SVG itself - SVG 1.2 which dates from 2004 was abandoned, and most browsers implement SVG 1.1 which is rather lacking in features. This makes it hard if you're a designer to produce SVG documents which a browser can actually render. At a bare minim…
Re: Ask HN:Whats the problem with SVG?
#17XML being XML, it's hard-to-impossible to host SVG without allowing people to store arbitrary XML on your service, which sooner or later is going to be abused.
Re: Ask HN:Whats the problem with SVG?
#18XML being XML, it's hard-to-impossible to host SVG without allowing people to store arbitrary XML on your service, which sooner or later is going to be abused.
Of course, why would anyone bother? It's that hard to find hosters that will host anything, so why do through the hassle to encruft your data with some somewhat unwieldy wrapper?
The fact that it's XML is in some way a "protection" here since for no particularly good reason some character codes cannot be represented by xml (not even encoded), meaning you'll need ugly workarounds to store arbitrary data.
Re: Ask HN:Whats the problem with SVG?
#19If you just want to shop them you could convert them to bitmap or host them on GitHub
If you want to include them on your website, they're small and compress well with gzip so why have the complexity of relying on a third party services
It you have too much traffic to be able to host them yourself then you should look at something like a CDN e.g. Cloudfront, infront of S3
Re: Ask HN:Whats the problem with SVG?
#20SVG implementations on browsers have historically been poor, though this is certainly improving. You'll hit many bugs and unsupported features. IE The worst problem may be SVG itself - SVG 1.2 which dates from 2004 was abandoned, and most browsers implement SVG 1.1 which is rather lacking in features. This makes it hard if you're a designer to produce SVG documents which a browser can actually render. At a bare minim…
I keep hoping that epub will generate a renaissance of interest in SVG. So far no luck.