Edgewall Software

Opened 16 years ago

Closed 12 years ago

Last modified 7 years ago

#5139 closed defect (duplicate)

SVG does not display correctly as an Image

Reported by: bytter@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords: mimeview IContentConverter
Cc: macke@… Branch:
Release Notes:
API Changes:
Internal Changes:


When using an SVG file in an Image tag, it is not correctly displayed (at least not under Firefox 1.5 or IE 7). SVG files should probably be outputed as an <object> tag (standards compliant) or as an <embed> tag.

Attachments (0)

Change History (11)

comment:1 by anonymous, 16 years ago

Having an option to automatically rasterize attached SVG images (or not) would be nice too. Although always delivering SVG files would be the perfect scenario, I see it adequate only when using trac on an intranet context. On the Web, there are still too many browsers that can't handle SVG properly.

comment:2 by Christian Boos, 16 years ago

Keywords: mimeview IContentConverter added
Milestone: not applicable

One could write a IContentConverter plugin for that, though that API is not yet finalized. So I'm keeping the ticket opened in order to keep it as a requirement when finalizing the API.

Related to #3332.

in reply to:  2 ; comment:3 by Emmanuel Blot, 16 years ago

Replying to cboos:

One could write a IContentConverter plugin for that, though that API is not yet finalized. So I'm keeping the ticket opened in order to keep it as a requirement when finalizing the API.

Related to #3332.

The rasterizing feature should be implemented in a plugin, you're right. It's a complex task which requires external, heavy tool(s), that is other dependencies. Plus it's usually quite difficult to handle some graphic items such as characters (font issues).
I had some very bad times with the th:wiki:GraphvizPlugin (due to the rasterizer, not to the plugin) and I've never been able to produce the expected results, not mentioning the dependency nightmare of librsvg.

in reply to:  3 comment:4 by Christian Boos, 16 years ago

Replying to eblot:

not mentioning the dependency nightmare of librsvg.

[OT] I had better luck taking the cairo route for making dot produce antialiased png, though having to compile half of Gnome to reach that point could be described as a nightmare as well ;-) (however, following the Linux From Scratch recipes, that was manageable, only long…)

comment:5 by anonymous, 14 years ago

why not use <object> for all images, SVG included?

comment:6 by rasmus.olsen@…, 14 years ago

I agree, using <object> instead of <img> would be the most foolproof method. http://www.w3.org/TR/REC-html40/struct/objects.html

comment:7 by Marcus Lindblom <macke@…>, 13 years ago

Cc: macke@… added

comment:8 by Marcus Lindblom <macke@…>, 13 years ago

SVG works reasoanbly well now. Would this be hard to fix?

comment:9 by Thomas Klein <t.klein@…>, 12 years ago

This ticket is 3 years old now. Nowadays, most browsers can render SVG sufficiently.
Thus, I guess many administrators of trac installations would choose to allow plain SVG images into wiki/ticket markup - just the same way you can include JPEG & PNG (this would obsolete http://trac-hacks.org/wiki/TracImageSvgMacro)

comment:10 by Christian Boos, 12 years ago

Milestone: not applicable
Resolution: duplicate
Status: newclosed

Well, actually you can directly point to an SVG file in the Image macro, as most recent browsers indeed support rendering "static" SVG in <img> elements.

Using <embed> as the above plugin does has some security implications (see the links cited ticket:9689#comment:6), but we might eventually add a separate Embed macro, probably as an optional component.

Closing in favor of #9689.

comment:11 by ted, 7 years ago

I currently use a homegrown automatic feedback grading system for running a data structures class. After students check in their programs, they currently visit a website to see analysis of their submission, with graphviz output in SVG. I planned on running it as a post-commit hook that would generate a trac ticket, but trac keeps the inline SVG that is generated on the fly as part of the page from properly showing. I was surprised that trac can't do it, as you should only need to conform to HTML5 with the correct doctype and allow the svg element to pass through to the browser unmodified. Surely this can be enabled. Is this not a reasonable expectation these days? I'd like to use this in class by January… earlier and I would be able to set up and test first.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.