DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:svgimg

Files SVG Plugin

Compatible with DokuWiki

2007-06-26 > 2006-11-06

plugin Provides the possibility to view SVG file into your web browser as PNG images.

Last updated on
2007-06-07

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with diagram, images, media, svg

Download plugin-svg.tgz

Installation Requirements:

This module is designed to work under many different situations and installation environments. There are only a few true requirements for installation.

PHP Version

It is recommended that PHP 5 or greater be used when running this plugin, however it should work with PHP 4.3.0 and up.

Requirements

The plugins need inkscape or convert (ImageMagick with SVG support) programs.

Inkscape is the default because it does a better conversion than convert.

Installation

Simply untar file in lib/plugins directory.

Add the line

svg     image/svg+xml

in conf/mime.conf file : to support upload of SVG files.

If you use Inkscape you need to have gnome-vfs2 installed. You need to create .inkscape and .gnome2 directory in Apache home directory and set own for him.

Example : (depend on your distribution)
cd /var/www
mkdir .inkscape
mkdir .gnome2
chown apache: .inkscape .gnome2

To use convert instead : edit lib/plugins/svgimg/resizeimg.php and comment line $cmd=sprintf(“inkscape .. and uncomment line above $cmd=sprintf(“convert

How this works

This plugins launches a JavaScript function which search all images in HTML page with SVG source. When it found one, it send a conversion with resizeimg.php program. This one send the conversion and store it in cache/svg directory. If it is already in cache the conversion is not done twice. By default the width of converted image is 100px. You can change the size with the common DokuWiki image syntax

{{start:chat_icon_01.svg|}}
{{start:cleanpalm_teudimundo_01.svg?200|}}

Comments

Instead of conf/mime.conf I would use conf/mime.local.conf instead to preserve the mime between upgrades. Scott

If you use convert instead of Inkscape: There are two lines starting with $cmd=sprintf(“convert . Uncomment the lower line and make sure you comment out the whole command $cmd=sprintf(“inkscape (it's split over three lines):

  //$cmd=sprintf("convert  -thumbnail %d %s %s",$size,escapeshellarg($source),   escapeshellarg($dest));
  //$cmd=sprintf("inkscape -z --export-width=%d  %s --export-png=%s>/dev/null",
  //    $size,
  //    escapeshellarg($source),
  //    escapeshellarg($dest));

  $cmd=sprintf("convert  -scale %dx%d $source $dest",$size,$size);

jeje

plugin/svgimg.txt · Last modified: 2009-10-07 19:02 by laynee