Manual:$wgSVGConverters

From MediaWiki.org

Jump to: navigation, search
SVG: $wgSVGConverters
Scalable Vector Graphics (SVG) may be uploaded as images.
Introduced in version: 1.4.0
Removed in version: still in use
Allowed values:
Default value: (see below)

Other settings: Alphabetical | By Function


Contents

[edit] Details

Scalable Vector Graphics (SVG) may be uploaded as images.

Since SVG support is not yet standard in browsers (all except Internet Explorer render SVGs, but not very accurately), it is necessary to rasterize SVGs to PNG as a fallback format. An external program is required to perform this conversion.

[edit] Default value

$wgSVGConverters = array(
    'ImageMagick' => '$path/convert -background white -thumbnail $widthx$height\! $input PNG:$output',
    'sodipodi' => '$path/sodipodi -z -w $width -f $input -e $output',
    'inkscape' => '$path/inkscape -z -w $width -f $input -e $output',
    'batik' => 'java -Djava.awt.headless=true -jar $path/batik-rasterizer.jar -w $width -d $output $input',
    'rsvg' => '$path/rsvg -w$width -h$height $input $output',
    'imgserv' => '$path/imgserv-wrapper -i svg -o png -w$width $input $output',
);

Note: 'rsvg' was added in 1.5.0

[edit] Platform-specific notes

[edit] Windows

On Windows, where the executable path may contain spaces, you may need to quote the executable name. For example:

$wgSVGConverters = array(
    'Inkscape' => '"$path/Inkscape/inkscape" -z -w $width -f $input -e $output',
);

[edit] Vista notes

Bug 20363 - cmd.exe not being executed correctly.

Inside file "GlobalFunctions.php" line 2207 delete the following lines

	elseif ( php_uname( 's' ) == 'Windows NT' ) {
		# This is a hack to work around PHP's flawed invocation of cmd.exe
		# http://news.php.net/php.internals/21796
		$cmd = '"' . $cmd . '"';
	}

Quotes were being used around "cmd.exe" to fix a bug in PHP. PHP's bug was fixed, so this hack is not needed. That is what is causing the SVG converters to not work correctly.

Also, Inkscape.exe does not accept command line arguments in the default release. You will need to download inkscapec.exe. Then set the $wgSVGConverters to the following.

$wgSVGConverters = array(
    'inkscape' => 'inkscapec.exe --file=$input --export-png=$output --export-width=$width --without-gui',
);

The inkscapec.exe handles both long and short versions of the commandline.

[edit] Linux

On some Linux installations (e.g. opensuse 10.3) rsvg is renamed: opensuse 10.3 for example:

$wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height -o $output $input');
$wgSVGConverter = 'rsvg' ;

If the Java executable is not in the path, it must be specified to use batik, or a "Thumbnail creation failed:" message will be displayed. For example:

$wgSVGConverters['batik'] = '/usr/local/bin/java -Djava.awt.headless=true -jar $path/batik-rasterizer.jar -w $width -d $output $input';

[edit] See also