From d94ad6db951f75fb7c8f7932cf2d8cc4521e4cfd Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 27 Aug 2008 18:25:24 +0000 Subject: [PATCH] Lets render BMP pictures to PNG. --- RELEASE-NOTES | 2 +- includes/media/BMP.php | 9 +++++++++ includes/media/Bitmap.php | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 73caa64e1d..f191f75c62 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/media/BMP.php b/includes/media/BMP.php index ce1b036281..39b297445b 100644 --- a/includes/media/BMP.php +++ b/includes/media/BMP.php @@ -11,6 +11,15 @@ * @ingroup Media */ class BmpHandler extends BitmapHandler { + // We never want to use .bmp in an 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. diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index e01386e939..39d70a6594 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -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 ); -- 2.20.1