Manual:$wgSVGConverters

From mediawiki.org
This page is a translated version of the page Manual:$wgSVGConverters and the translation is 95% complete.
SVG: $wgSVGConverters
Scalable Vector Graphics (SVG)コンバータへのパスのリスト。
導入されたバージョン:1.4.0
除去されたバージョン:使用中
許容される値:(配列) 下記参照
既定値:下記参照

詳細

Scalable Vector Graphics (SVG)は画像としてアップロードすることができます。 しかし、ブラウザでのSVGのサポートは不安定です。特に、Internet Explorer 9以前では、SVG形式を全く理解できませんでした。

したがって、SVG形式の画像をPNG形式に変換してフォールバックする必要があります。 この変換を実行するには外部プログラムが必要です。

この配列にはSVG変換プログラムのリストとそれぞれのコマンドラインが含まれています。 システムで使用するものを選択するには、$wgSVGConverter 変数を設定します。

既定値

MediaWiki バージョン:
1.39
$wgSVGConverters = [
	'ImageMagick' => '$path/convert -background "#ffffff00" -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-convert -w $width -h $height -o $output $input',
	'imgserv' => '$path/imgserv-wrapper -i svg -o png -w$width $input $output',
	'ImagickExt' => [ 'SvgHandler::rasterizeImagickExt', ],
];
MediaWiki バージョン:
1.25 – 1.38
$wgSVGConverters = [
	'ImageMagick' =>
		'$path/convert -background "#ffffff00" -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-convert -w $width -h $height -o $output $input',
	'imgserv' => '$path/imgserv-wrapper -i svg -o png -w$width $input $output',
	'ImagickExt' => [ 'SvgHandler::rasterizeImagickExt' ],
];
MediaWiki バージョン:
1.23 – 1.24
$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',
	'ImagickExt' => array( 'SvgHandler::rasterizeImagickExt' ),
);
MediaWiki バージョン:
1.21 – 1.22
$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',
	'ImagickExt' => array( 'SvgHandler::rasterizeImagickExt' ),
);
MediaWiki バージョン:
1.18 – 1.20
$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',
	'ImagickExt' => array( 'SvgHandler::rasterizeImagickExt' ),
	);
MediaWiki バージョン:
1.14 – 1.17
$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',
	);
MediaWiki バージョン:
1.13

1.13

$wgSVGConverters = array(
	'ImageMagick' => '$path/convert -background white -geometry $width $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',
	);
MediaWiki バージョン:
1.10 – 1.12
$wgSVGConverters = array(
	'ImageMagick' => '$path/convert -background white -geometry $width $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',
	);
MediaWiki バージョン:
1.5 – 1.9
$wgSVGConverters = array(
	'ImageMagick' => '$path/convert -background white -geometry $width $input $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',
	);
MediaWiki バージョン:
1.4
$wgSVGConverters = array(
	'ImageMagick' => '$path/convert -background white -geometry $width $input $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',
	);

使用法

以下の変数はコマンドラインで指定できます。

  • $path - もし指定する場合の、$wgSVGConverterPath の変数。未指定だと $path/ (スラッシュに注意) は除去
  • $input - インプット対象の SVG ファイルのパス
  • $output - MediaWiki が出力した PNG を探すパス
  • $width - 希望の幅
  • $height - 希望の高さ
感嘆符 '(!)' は Unix シェルではメタ文字のため、バックスラッシュ「\」を付けてエスケープします。 上記のコード見本では、これは ImageMagick のコマンドに書いてあります。 Windows ファミリーの OS のシェルでは感嘆符 (!) はメタ文字ではないため、エスケープは不用です。

仮のサンプルを用意、実行可能な名前のついた mysvg2png がシステムパスにあるとします。

$wgSVGConverters = [
	'mysvg2png' => '$path/mysvg2png -input $input -toFormat PNG -w $width -h $height -output $output'
];
$wgSVGConverter = 'mysvg2png';

プラットフォーム固有の注記

Windows

Windows では実行可能なパスに空白スペースが含まれているなら、実行するネームを引用符で挟むほうが安全です。 例:

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

Windows ファミリーの OS のシェルでは感嘆符 (!) はメタ文字ではないため、エスケープは不用です。

Inkscape.exe does not accept command line arguments in the default release. inkscapec.exe をダウンロードしてください。 次に $wgSVGConverters を以下にしたがって設定します。

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

inkscapec.exe ではコマンドラインが長くても短くても処理します。

Windows ファミリーの OS のシェルでは感嘆符 (!) はメタ文字ではないため、エスケープは不用です。

Linux

Linux インストレーションの一部 (例 OpenSuSE 10.3、Debian、Ubuntu) では rsvg はリネームされます (さらに別にパッケージ化される場合があります):

$wgSVGConverters = [ '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. 例:

$wgSVGConverters['batik'] = '/usr/local/bin/java -Djava.awt.headless=true -jar $path/batik-rasterizer.jar -w $width -d $output $input';
感嘆符 '(!)' は Unix シェルではメタ文字のため、バックスラッシュ「\」を付けてエスケープします。

OpenBSDおよびFreeBSD

OpenBSD と FreeBSD インストレーションではかつて、rsvgrsvg-convert にリネームしていました:

$wgSVGConverterPath = "/usr/local/bin";
$wgSVGConverters = [ 'rsvg' => '$path/rsvg-convert -w $width -h $height -o $output $input' ];
$wgSVGConverter = 'rsvg' ;

関連項目