Summary: Talk page for Svg.
Maintainer: Petko (originally written by Pm)
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

APE Resolution Request

We use APE on our site but I also want to be able to use SVG. Has the conflict been resolved?

Ape has the vocation to make it easy to embed various pieces of media, I only need to find the time to add stuff other than external providers. Would you like to download a pre-release, test in various situations it and report if it works?

To enable SVG embed with the new version, disable svg.php, and add to config.php this line:

  # Disable SVG handling by the core (since PmWiki 2.2.85)

Then in a page use simply %embed width=200px height=100px% Attach:file.svg %% with a local attachment or external URL. See some examples here. --Petko July 16, 2017, at 11:55 AM

As there is no reaction, I'll just go and update the Ape recipe making this one obsolete. --Petko July 24, 2017, at 03:35 PM

Svg recipe and SiteAnalyzer

In SiteAnalyzer the recipe appears as "Cookbook:SVG?".
As a result, it can not be compared with "Cookbook:Svg"
Changing the line

 $RecipeInfo['SVG']['Version'] = '20150919';


 $RecipeInfo['Svg']['Version'] = '20150919';

seems to fix the problem.
I hope that this small fix doesn't introduce any other problem.

Thanks, fixed. --Petko October 20, 2016, at 11:18 PM

PHP 5.5

Still my server is in PHP5.6.8, the message of my wiki is "Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in....". Is there an issue with a new svg.php or a new version of PMwiki?

I've updated the recipe and it should work now. You need PmWiki 2.2.58 or newer (latest recommended). --Petko September 19, 2015, at 08:13 AM

Bug Report?

I am using the form %width=700 height=300% Attach:test.svg In the displayed page, I get a link, which does display the svg when clicked on. Is this correct behavior? From reading the docs it seems like svg's may be embedded in other pages. pb 9/28/2016 pmwiki 2.2.72

Old Discussion

Upgrading to Adobe SVG Viewer version 3.03 (use with WinXP/IE) won't display .svg files anymore. PITS 00438 -scoid?

Bug Report -- Duplicate Variable Name

This recipe has a "cut and paste" error from the Flash recipe that it was borrowd from. This recipe will conflict with the Flash recipe and the Visio recipe which also has this error.

To address this error, SwfTagFmt must be replaced in the recipe in two places. I suggest using SvgTagFmt or something else the should be relatively unique. This error will cause all the recipes that use this SwfTagFmt variable name to get the mime specific replacement from whichever recipe was loaded last.

Reported by -Kurt Devlin February 16, 2006, at 03:57 PM

Fix proposal with support for alternate content

<?php if (!defined('PmWiki')) exit();
/*  Copyright (C) 2004 Patrick R. Michaud <>
    Copyright (C) 2006 Christoph Sommer <>

    This file is distributed under the terms of the GNU General Public 
    License as published by the Free Software Foundation; either 
    version 2 of the License, or (at your option) any later version.  

    This module enables embedding of Scaleable Vector Grafics (.svg) files into
    wiki pages.  

    To use this module, simply place this file in the cookbook/ directory
    and add the following line into config.php:


    You can then embed SVG files into a wiki file by adding lines following
    these examples:

    %width=700 height=300%
    %width=700 height=300% Attach:test.svg
    %width=700 height=300% Attach:test.svg"Alternate Content"
    %width=700 height=300% Attach:test.svg"Attach:test.gif"


// Public recipe information
$RecipeInfo['Svg']['Version'] = '2006-11-22';

// Allow uploading of files ending in .svg or .svgz
$UploadExts['svg'] = 'image/svg+xml';
$UploadExts['svgz'] = 'image/svg+xml';

// Define replacements for SVG ressources
Markup('svg', '<urllink', 
  '<object type=\'image/svg+xml\' data=\'\$LinkUrl\'>'), 'L').'$4'.Keep('</object>')");



 %width=700 height=300% http://server/dir/test.svg
 %width=700 height=300% Attach:test.svg


Bug Fixes

The Adove SVG Viewer 3.03 IE problem can be fixed by replacing the last script line with:

 '<object type=\'image/svg+xml\' data=\'\$LinkUrl\'> <param name=\'src\' value=\'\$LinkUrl\'>'), 'L').'$4'.Keep('</object>')");

(added by Lorenz)

To properly handle SVGZ files, the markup declaration must be changed to the following:

 Markup('svg', '<urllink', 

Talk page for the Svg recipe (users).