TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN:Whats the problem with SVG?

23 点作者 lousy_sysadmin超过 12 年前
I've been playing around with Inkscape for a while now to create vector image as its one of the easiest solution for Retina-esque site. However I'm having a hard time finding image hosting that support SVG.<p>My question is, why is it so hard for image hosting service to support native SVG, instead of converting an image to other format. Would like to hear the limitations and challenges that comes with it.<p>http://imgur.userecho.com/topic/23630-svg-support/

10 条评论

jahewson超过 12 年前
SVG implementations on browsers have historically been poor, though this is certainly improving. You'll hit many bugs and unsupported features. IE &#60; 9 doesn't support SVG at all, and Safari &#60; 6 only does so in XHTML. SVG fonts are sparsely supported. The alternative - rasterising SVG on the server - is a heavyweight task, I've not found any libraries which can do this quickly.<p>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.<p>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 &#60;script&#62; 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 -&#62; PDF -&#62; SVG via cairosvg and pdftocairo, though it may burn some CPU.
评论 #5129839 未加载
评论 #5124857 未加载
评论 #5128619 未加载
评论 #5124192 未加载
nwh超过 12 年前
I'd considered making one some time ago, but gave up when I realised that somebody had already purchased <a href="http://s.vg/" rel="nofollow">http://s.vg/</a>.
lmm超过 12 年前
XML 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.
评论 #5124233 未加载
评论 #5124139 未加载
评论 #5124226 未加载
mbq超过 12 年前
_Arbitrary_ SVG is a security/privacy problem -- it may inject JS or exploit quirks in rendering to manipulate site contents, import external images and fonts, or simply be a render bomb. And it is hard to filter out those problems.
评论 #5123909 未加载
pre超过 12 年前
It's not hard, probably the image hosts concerned merely didn't think to include it.<p>You can upload svg files with the right content type to Amazon S3 without trouble, is that not good enough?
youngtaff超过 12 年前
My question is why do you want to host your SVG images elsewhere?<p>If you just want to shop them you could convert them to bitmap or host them on GitHub<p>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<p>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
timrogers超过 12 年前
I'm guessing you could maybe host it with Gists, using the raw link? Although the content type headers might be an issue...
lsiebert超过 12 年前
It'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.<p>Isn't SVG just XML? I'd assume you could host it that way.
评论 #5123811 未加载
Turing_Machine超过 12 年前
You might look at <a href="http://openclipart.org/" rel="nofollow">http://openclipart.org/</a> to see how they're handling it.
wisty超过 12 年前
IE6. XML viruses.