$wgUseImageMagick = false;
$wgImageMagickConvertCommand = '/usr/bin/convert';
+# Scalable Vector Graphics (SVG) may be uploaded as images.
+# Since SVG support is not yet standard in browsers, it is
+# necessary to rasterize SVGs to PNG as a fallback format.
+#
+# An external program is required to perform this conversion:
+$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',
+ );
+$wgSVGConverter = 'ImageMagick'; # Pick one of the above
+$wgSVGConverterPath = ''; # If not in the executable PATH, specify
+
# PHPTal is a library for page templates. MediaWiki includes
# a recent PHPTal distribution. It is required to use the
# Monobook (default) skin.
return '';
}
- if( $width > $this->width ) {
+ if( $width > $this->width && !$this->mustRender() ) {
# Don't make an image bigger than the source
return $this->getViewURL();
}
if ( (! file_exists( $thumbPath ) ) || ( filemtime($thumbPath) < filemtime($this->imagePath) ) ) {
- if ( $wgUseImageMagick ) {
+ if( $this->extension == 'svg' ) {
+ global $wgSVGConverters, $wgSVGConverter;
+ if( isset( $wgSVGConverters[$wgSVGConverter] ) ) {
+ global $wgSVGConverterPath;
+ $cmd = str_replace(
+ array( '$path/', '$width', '$input', '$output' ),
+ array( $wgSVGConverterPath,
+ $width,
+ escapeshellarg( $this->imagePath ),
+ escapeshellarg( $thumbPath ) ),
+ $wgSVGConverters[$wgSVGConverter] );
+ $conv = shell_exec( $cmd );
+ } else {
+ $conv = false;
+ }
+ } elseif ( $wgUseImageMagick ) {
# use ImageMagick
# Specify white background color, will be used for transparent images
# in Internet Explorer/Windows instead of default black.