|
Cookbook /
SvgSummary: Embedding Scalable Vector Graphics (.SVG) into PmWiki pages
Version: 1
Prerequisites: pmwiki 2
Status:
Maintainer:
QuestionCan Scaleable Vector Graphics (*.svg) be embedded into wiki pages? AnswerThe svg.phpΔ script causes links ending in ".svg" to be converted to embedded svg-grafs (similar to how images are automatically embedded into pages). If you want up upload svg-files you have to enable the file type by expanding the UploadExts-Array. SDVA($UploadExts,array( ... 'svg' => 'image/svg+xml', ... This should be $UploadExts['svg'] = 'image/svg+xml';and this should work if set at the beginning of your php module, in immediate execution, so no need to have user to do anything - untested -PRZ When using this, the DiscussionPlace the svg.phpΔ script in your cookbook/ directory, add the line include_once('cookbook/svg.php');
to your config.php file, and any link ending in ".svg" will automatically be converted to HTML code for an embedded svg graphic. 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 NameThis 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 <pmichaud@pobox.com>
Copyright (C) 2006 Christoph Sommer <http://www.deltadevelopment.de/users/christoph/>
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:
include_once('cookbook/svg.php');
You can then embed SVG files into a wiki file by adding lines following
these examples:
%width=700 height=300% http://www.example.com/dir/test.svg
%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',
"/\\b(?>(\\L))([^\\s$UrlExcludeChars]+\\.svg)(\"([^\"]*)\")?/e",
"Keep(\$GLOBALS['LinkFunctions']['$1'](\$pagename,'$1','$2',NULL,'$1$2',
'<object type=\'image/svg+xml\' data=\'\$LinkUrl\'>'), 'L').'$4'.Keep('</object>')");
?>
Examples%width=700 height=300% http://server/dir/test.svg %width=700 height=300% Attach:test.svg Testfileshttp://www.netcomplett.de/Technologie/VML/Teilekatalog/figure.svg http://www.croczilla.com/svg/samples/circles1/circles1.svg Bug FixThe 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) Contributors |