Summary: Embedding Scalable Vector Graphics (.SVG) into PmWiki pages
Version: 20161021
Prerequisites: pmwiki 2.2.58
Maintainer: Petko (originally written by Pm)
Categories: Media, Images, PHP55
Discussion: Svg-Talk
License: GPLv2+


Can Scalable Vector Graphics (*.svg) be embedded into wiki pages?


NOTE: SVG support has been available to the pmwiki core since version 2.2.85, 2016-03-31.
That means, that most likely you don't need this recipe.
Just insert the svg in your page, like you would insert another image.
Most browsers released in the recent years support it:

The svg.phpΔ script causes links ending in ".svg" to be converted to embedded svg-grafs (similar to how images are automatically embedded into pages).


Place the svg.phpΔ script in your cookbook/ directory, add the line


to your config.php file, and any link ending in ".svg" will automatically be converted to HTML code for an embedded svg graphic.

If you want up upload svg-files you have to enable the file type. Add this to config.php:

  $UploadExts['svg']  = 'image/svg+xml';
  $UploadExts['svgz'] = 'image/svg+xml';

When using this, the %width=300 height=200% WikiStyle has to be placed before the svg file name to define the painting area (set the width and height of your graphic in pixels).


When installed with Cookbook:Ape, this recipe doesn't allow the Ape recipe to define the frame width and height.

Release notes

  • 20161021 Disable core handling of SVG links (since PmWiki 2.2.85), fix $RecipeInfo.
  • 20150919 Update for PHP 5.5, use non conflicting $SvgTagFmt variable, accept ".svgz" extension, add $RecipeInfo.



See discussion at Svg-Talk.

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.