Lets render BMP pictures to PNG.
authorAntoine Musso <hashar@users.mediawiki.org>
Wed, 27 Aug 2008 18:25:24 +0000 (18:25 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Wed, 27 Aug 2008 18:25:24 +0000 (18:25 +0000)
RELEASE-NOTES
includes/media/BMP.php
includes/media/Bitmap.php

index 73caa64..f191f75 100644 (file)
@@ -98,7 +98,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add tooltips to rollback and undo links
 * Backend upload code has been removed from SpecialUpload.php. This may cause 
   backwards incompatibility with upload extensions.
-
+* BMP images are now displayed as PNG
 
 === Bug fixes in 1.14 ===
 
index ce1b036..39b2974 100644 (file)
  * @ingroup Media
  */
 class BmpHandler extends BitmapHandler {
+       // We never want to use .bmp in an <img/> tag
+       function mustRender( $file ) {
+               return true;
+       }
+
+       // Render files as PNG
+       function getThumbType( $text, $mime ) {
+               return array( 'png', 'image/png' );
+       }
 
        /*
         * Get width and height from the bmp header.
index e01386e..39d70a6 100644 (file)
@@ -59,7 +59,7 @@ class BitmapHandler extends ImageHandler {
                $retval = 0;
                wfDebug( __METHOD__.": creating {$physicalWidth}x{$physicalHeight} thumbnail at $dstPath\n" );
 
-               if ( $physicalWidth == $srcWidth && $physicalHeight == $srcHeight ) {
+               if ( !$image->mustRender() && $physicalWidth == $srcWidth && $physicalHeight == $srcHeight ) {
                        # normaliseParams (or the user) wants us to return the unscaled image
                        wfDebug( __METHOD__.": returning unscaled image\n" );
                        return new ThumbnailImage( $image, $image->getURL(), $clientWidth, $clientHeight, $srcPath );