Quickie experimental SVG rasterization hack: if using $wgImageMagick, will attempt to create thumbnails of SVG images as PNG.
Incomplete so far: * If you just ask for the image (or eg look at the image page) without a size, it tries a straight <img> with no rasterization still * ImageMagick may not be the best renderer. * It doesn't know the 'real' size of aspect ratio of the image.
This commit is contained in:
parent
2115d6c008
commit
b887b260a6
1 changed files with 13 additions and 1 deletions
|
|
@ -54,6 +54,9 @@ class Image
|
|||
}
|
||||
|
||||
$this->url = $this->wfImageUrl( $name );
|
||||
|
||||
$n = strrpos( $name, '.' );
|
||||
$this->extension = strtolower( $n ? substr( $name, $n + 1 ) : '' );
|
||||
|
||||
if ( $this->fileExists = file_exists( $this->imagePath ) ) // Sic!, "=" is intended
|
||||
{
|
||||
|
|
@ -68,6 +71,10 @@ class Image
|
|||
} else {
|
||||
$this->bits = 0;
|
||||
}
|
||||
} elseif( $this->extension == 'svg' ) {
|
||||
$this->width = 512;
|
||||
$this->height = 512;
|
||||
$this->type = 'svg';
|
||||
}
|
||||
}
|
||||
$this->historyLine = 0;
|
||||
|
|
@ -234,7 +241,12 @@ class Image
|
|||
* @access private
|
||||
*/
|
||||
function thumbName( $width ) {
|
||||
return $width."px-".$this->name;
|
||||
$thumb = $width."px-".$this->name;
|
||||
if( $this->extension == 'svg' ) {
|
||||
# Rasterize SVG vector images to PNG
|
||||
$thumb .= '.png';
|
||||
}
|
||||
return $thumb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue