[Home]WikiSuggestions/EmbeddingSVG

UseModWiki | WikiSuggestions | RecentChanges | Preferences

Embedding an image in a UseMod Wiki page is very easy. For example, here's the UseMod gif:

SVG is very interesting, and people are starting to use it more and more these days with the availability of multiple SVG viewers/plugins written for multiple platforms. It would nice to be able to do the same thing with an SVG URL.

I'd like to be able to embed an SVG graphic, by using the URL: http://www.blah.com/drawing.svg

I'm making some progress towards achieving this goal, but I think that there are some problems with using the UrlLink? function. Add this to the end of the UrlLink? subroutine:

  # Added support for recognizing SVG urls.  Note that use of the
  # object tag to embed SVG is valid only in Mozilla, Opera, IE 4-5,
  # and Netscape 4
  if ($useImage && ($name =~ /^(http:|https:|ftp:).+\.(svg|svgz)$/)) {
    return ("<object data=\"$name\" type=\"image/svg+xml\"></object>", $punct);
  }

There are two problems with this approach:

does anyone have any ideas?

For WikiPedia I've proposed (MetaWikiPedia?:SVG_image_support) rasterizing the SVG with an external program (like [sodipodi]); the resulting PNG can be used as an alternate presentation for browsers that can't display a SVG directly or with a plugin (just stick it inside the <object>...</object>), and its pixel size can be extracted and used as a basis for sizing the object. This might be less practicable when dealing exclusively with externally linked images instead of uploads to the host, though. --BrionVibber

UseModWiki | WikiSuggestions | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited November 6, 2023 8:45 pm by MarkusLude (diff)
Search: