Localisation updates for extension messages from Betawiki
[lhc/web/wiklou.git] / includes / media / SVG.php
index 2dfbd02..2604e3b 100644 (file)
@@ -1,7 +1,11 @@
 <?php
+/**
+ * @file
+ * @ingroup Media
+ */
 
 /**
- * @addtogroup Media
+ * @ingroup Media
  */
 class SvgHandler extends ImageHandler {
        function isEnabled() {
@@ -14,7 +18,7 @@ class SvgHandler extends ImageHandler {
                }
        }
 
-       function mustRender() {
+       function mustRender( $file ) {
                return true;
        }
 
@@ -31,14 +35,14 @@ class SvgHandler extends ImageHandler {
                        $srcWidth = $image->getWidth( $params['page'] );
                        $srcHeight = $image->getHeight( $params['page'] );
                        $params['physicalWidth'] = $wgSVGMaxSize;
-                       $params['physicalHeight'] = Image::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
+                       $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
                }
                return true;
        }
-       
+
        function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
                global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath;
-               
+
                if ( !$this->normaliseParams( $image, $params ) ) {
                        return new TransformParameterError( $params );
                }
@@ -46,14 +50,14 @@ class SvgHandler extends ImageHandler {
                $clientHeight = $params['height'];
                $physicalWidth = $params['physicalWidth'];
                $physicalHeight = $params['physicalHeight'];
-               $srcPath = $image->getImagePath();
+               $srcPath = $image->getPath();
 
                if ( $flags & self::TRANSFORM_LATER ) {
-                       return new ThumbnailImage( $dstUrl, $clientWidth, $clientHeight, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
 
                if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
-                       return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, 
+                       return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight,
                                wfMsg( 'thumbnail_dest_directory' ) );
                }
 
@@ -80,7 +84,7 @@ class SvgHandler extends ImageHandler {
                                        wfHostname(), $retval, trim($err), $cmd ) );
                        return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err );
                } else {
-                       return new ThumbnailImage( $dstUrl, $clientWidth, $clientHeight, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
        }
 
@@ -91,5 +95,12 @@ class SvgHandler extends ImageHandler {
        function getThumbType( $ext, $mime ) {
                return array( 'png', 'image/png' );
        }
+
+       function getLongDesc( $file ) {
+               global $wgLang;
+               return wfMsgExt( 'svg-long-desc', 'parseinline',
+                       $wgLang->formatNum( $file->getWidth() ),
+                       $wgLang->formatNum( $file->getHeight() ),
+                       $wgLang->formatSize( $file->getSize() ) );
+       }
 }
-?>