Using SVG on the forum

Started by
4 comments, last by Rich Brighton 3 months, 2 weeks ago

So I've been a member of the forum for quite a while but hardly been active at all. I'm interested in blogging about a project I've been working on for some time. A key question for me on presentation is, can I use SVG on the forum?

<svg width='500' height = '120'>

<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />

</svg>

I've tried to include a noddy SVG artifact above.

Advertisement

SVG is not currently possible in the editor, but I like this idea and looking into the necessary changes.

Admin for GameDev.net.

@khawk Thanks much appreciated. So I notice that SVG is also not currently included in up-loadable file formats. I wonder whether this would be easier to implement than modifying the editor. Pretty much all the SVG I want to use on this site or in other places would be programmatically generated. So I think most my preference would be upload it in a separate file. In fact I've now decided to do that on my own website rather having large chunks of SVG intermingled inside HTML files.

Its a bit disappointing generally how restricted the use of SVG is on fora and social media generally. The above PNG file is 5.3 kilobytes. The JPEG version is 2k, while the original SVG file is 151 bytes. Many places don't allow the uploading of images at all. All images have to be linked in. While SVG can offer a lot of possibilities even with a pretty restrictive file size limit.

Yeah, I think that's because SVG is “code” it can be potentially be used to carry malicious JS code. It's easier to just ignore it. Even the image upload would need sanitization to remove malicious JS embedded in the SVG.

That's the biggest issue I see with supporting it. Not impossible, but need to make sure we don't create an attack vector here. And GameDev.net sees a ton of spam and general attacks that it needs to be taken seriously.

Admin for GameDev.net.

@khawk That's useful to know. There's some very basic areas of computing of which I'm woefully ignorant. My main targets have been JavaFx canvas and Web canvas. I programme in Scala, which can be compiled to java byte code of Javascript, so the JS / JavaFx specific code required is very small. I'd figured that if my project ever took off then the much more complex and challenging tasks of creating an OpenGL or a DirectX target could be attempted.

Web Canvas needs Javascript, so I had naively assumed that by creating an SVG target, I could avoid Javascript issues. But now things are starting to make more sense.

This topic is closed to new replies.

Advertisement