I am unable to upload SVG image files to Stack Overflow. So I would like to know why it is blocked while other image formats are allowed. SVG images are useful for diagrams such as tree diagrams for algorithm discussions.
What is meta?
- Any Stack Exchange user can ask a question
- The community provides support, votes on ideas, and reports bugs
- Your voice helps shape the way Stack Exchange operates
Stack Exchange supports image uploading by using an external service (imgur) which does not support vector images.
You'll need to convert your SVG into a raster format (PNG is probably the best choice for most vector images, but JPG, GIF, and even BMP are supported) before uploading them to the provided service.
Stack Exchange is not interested in building an image hosting service (which is why they use imgur) so it's unlikely that they will either create one, or encourage imgur to support vector image formats.
However, if you find a free vector image hosting service that can handle the load Stack Overflow puts on such a service, and provides an API that is as simple and easy to include as imgur's, then you might be able to convince Stack Exchange, Inc, to include support for your request.
Alternately you should consider going to imgur and requesting that they support vector image formats. It would be ideal if they did the hard work, because, using browser detection methods, they could also support browsers that don't have SVG support by rendering the image prior to display, or they could even render it on upload and only store the rendered image (thus not affecting their normal workflow since it's simply a raster image after upload and conversion).
Unless you make it trivial for Stack Exchange to include in their code, you are unlikely to get much support for your feature request.
While you can’t directly upload an SVG image, if you can host it somewhere else, you can still display it in your post using HTML like
For example, take this US map here from Wikimedia Commons
See this post for other examples of what you can do.
That said, it might be possible to just use them for binary storage and render the SVGs correctly here?
These days you can paste the SVG markup into the HTML area in a Stack Snippet and it will render in the question or answer in most browsers.
If you upload the SVG as a file and reference it as an image (via the html
Neither can you trigger animation via clicking e.g via begin="click" as I've done above as that SVG capability is also disabled when it's used as an image.
So despite the need to click Run to display the SVG you may need to do it this way instead.
I'd imagine part of the reason is that Microsoft only support SVG since IE9, and most people use IE as their browser but have not upgraded to 9.
Examples of browser usage statitistics: http://www.w3counter.com/globalstats.php, http://gs.statcounter.com/#browser_version-ww-monthly-201004-201104-bar
Getting SVG support into IE8 would require a JS/flash plugin like SVG Web, which would cause significant bandwidth usage for an infrequent feature.
Either that or take the SVG markup and return a PNG. But that sounds like a lot of work for a Q&A website to undertake.