* Standardised file description headers
[lhc/web/wiklou.git] / includes / media / Generic.php
index 8a4d705..9dbd7e3 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 /**
  * Media-handling base classes and generic functionality
+ *
  * @file
  * @ingroup Media
  */
@@ -72,7 +73,7 @@ abstract class MediaHandler {
         * can't be determined.
         *
         * @param $image File: the image object, or false if there isn't one
-        * @param $fileName String: the filename
+        * @param $path String: the filename
         * @return Array
         */
        abstract function getImageSize( $image, $path );
@@ -139,7 +140,7 @@ abstract class MediaHandler {
         * Get the thumbnail extension and MIME type for a given source MIME type
         * @return array thumbnail extension and MIME type
         */
-       function getThumbType( $ext, $mime ) {
+       function getThumbType( $ext, $mime, $params = null ) {
                return array( $ext, $mime );
        }
 
@@ -357,9 +358,19 @@ abstract class ImageHandler extends MediaHandler {
                if ( !isset( $params['width'] ) ) {
                        return false;
                }
+
                if ( !isset( $params['page'] ) ) {
                        $params['page'] = 1;
+               } else  {
+                       if ( $params['page'] > $image->pageCount() ) {
+                               $params['page'] = $image->pageCount();
+                       }
+
+                       if ( $params['page'] < 1 ) {
+                               $params['page'] = 1;
+                       }
                }
+
                $srcWidth = $image->getWidth( $params['page'] );
                $srcHeight = $image->getHeight( $params['page'] );
                if ( isset( $params['height'] ) && $params['height'] != -1 ) {
@@ -386,6 +397,9 @@ abstract class ImageHandler extends MediaHandler {
         *
         * @param $width Integer: specified width (input/output)
         * @param $height Integer: height (output only)
+        * @param $srcWidth Integer: width of the source image
+        * @param $srcHeight Integer: height of the source image
+        * @param $mimeType Unused
         * @return false to indicate that an error should be returned to the user.
         */
        function validateThumbParams( &$width, &$height, $srcWidth, $srcHeight, $mimeType ) {
@@ -424,6 +438,10 @@ abstract class ImageHandler extends MediaHandler {
                return $gis;
        }
 
+       function isAnimatedImage( $image ) {
+               return false;
+       }
+
        function getShortDesc( $file ) {
                global $wgLang;
                $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),