Add a new isVectorized() to files and media handlers. Only SVG returns true.
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Sun, 31 Oct 2010 21:49:25 +0000 (21:49 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Sun, 31 Oct 2010 21:49:25 +0000 (21:49 +0000)
Related to Bug 19633.

includes/filerepo/File.php
includes/media/Generic.php
includes/media/SVG.php

index 77b1b16..063fb16 100644 (file)
@@ -266,6 +266,19 @@ abstract class File {
                }
        }
 
+       /**
+         * Get the duration of a media file in seconds
+         */
+        public function isVectorized() {
+                $handler = $this->getHandler();
+                if ( $handler ) {
+                        return $handler->isVectorized( $this );
+                } else {
+                        return false;
+                }
+        }
+
+
        /**
         * Get handler-specific metadata
         * Overridden by LocalFile, UnregisteredLocalFile
index db3f4ce..92f0304 100644 (file)
@@ -161,6 +161,10 @@ abstract class MediaHandler {
         * Page count for a multi-page document, false if unsupported or unknown
         */
        function pageCount( $file ) { return false; }
+       /**
+        * The material is vectorized and thus scaling is lossless
+        */
+       function isVectorized( $file ) { return false; }
        /**
         * False if the handler is disabled for all files
         */
index 242b264..c254165 100644 (file)
@@ -26,6 +26,10 @@ class SvgHandler extends ImageHandler {
                return true;
        }
 
+       function isVectorized( $file ) {
+               return true;
+       }
+
        function normaliseParams( $image, &$params ) {
                global $wgSVGMaxSize;
                if ( !parent::normaliseParams( $image, $params ) ) {