From 5808535e167e026effc31a88bd55f3900e96f6b7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 25 Jun 2006 06:23:53 +0000 Subject: [PATCH] * Fix display of file-type icons in galleries when $wgIgnoreImageErrors is off --- RELEASE-NOTES | 2 ++ includes/Image.php | 10 ++++++---- includes/ImageGallery.php | 3 --- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a9bbcb6443..22848d919c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -562,6 +562,8 @@ Some default configuration options have changed: * Improve default blank content of MediaWiki:Common.css and MediaWiki:Monobook.css * (bug 6434) Allow customisation of submit button text on Special:Export * (bug 6314) Add user tool links on page histories +* Fix display of file-type icons in galleries when $wgIgnoreImageErrors is off + == Compatibility == diff --git a/includes/Image.php b/includes/Image.php index a0436261f0..16fc55b5ca 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -882,6 +882,8 @@ class Image * provide access to the actual file, the real size of the thumb, * and can produce a convenient tag for you. * + * For non-image formats, this may return a filetype-specific icon. + * * @param integer $width maximum width of the generated thumbnail * @param integer $height maximum height of the image (optional) * @return ThumbnailImage or null on failure @@ -896,11 +898,11 @@ class Image if ($this->canRender()) { if ( $width > $this->width * $height / $this->height ) $width = wfFitBoxWidth( $this->width, $this->height, $height ); - $thumb = $this->renderThumb( $width ); + return $this->renderThumb( $width ); + } else { + // not a bitmap or renderable image, don't try. + return $this->iconThumb(); } - else $thumb= NULL; #not a bitmap or renderable image, don't try. - - return $thumb; } /** diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index ccf2c146f7..001305fa36 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -184,9 +184,6 @@ class ImageGallery $s .= ($i%4==0) ? '' : ''; $thumb = $img->getThumbnail( 120, 120 ); - if ( !$thumb && $wgIgnoreImageErrors ) { - $thumb = $img->iconThumb(); - } if ( $thumb ) { $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2; $s .= '
' . '
'; -- 2.20.1