Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
142 views
in Q2A Core by
edited by

What I wanted to do: Upload an SVG text file and embed it via:

        <img src="http://www.mathelounge.de/?qa=blob&amp;qa_blobid=6000185185832819410" />

Which does not render the image.

The browser is the latest Firefox (46.0.1) which is capable of displaying SVG. So I guess it is the mime type that is not delivered by q2a.

I just remember the pdf embed issue: https://github.com/q2a/question2answer/issues/174

And found that SVG is missing: https://github.com/q2a/question2answer/blob/dev/qa-include/qa-blob.php#L56

Can we add this?

---

Update: This is the fix/addition:

            case 'svg':
                header('Content-Type: image/svg+xml');
                break;

---

PS: There could be security concerns since SVG *can* contain javascript, see https://www.w3.org/TR/SVG/script.html#ScriptElement but also here do exist solutions, e.g. https://github.com/darylldoyle/svg-sanitizer

Q2A version: 1.7.4

Please log in or register to answer this question.

...