* Fix display of file-type icons in galleries when $wgIgnoreImageErrors is off
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 25 Jun 2006 06:23:53 +0000 (06:23 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 25 Jun 2006 06:23:53 +0000 (06:23 +0000)
RELEASE-NOTES
includes/Image.php
includes/ImageGallery.php

index a9bbcb6..22848d9 100644 (file)
@@ -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 ==
 
index a043626..16fc55b 100644 (file)
@@ -882,6 +882,8 @@ class Image
         * provide access to the actual file, the real size of the thumb,
         * and can produce a convenient <img> 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;
        }
 
        /**
index ccf2c14..001305f 100644 (file)
@@ -184,9 +184,6 @@ class ImageGallery
 
                        $s .= ($i%4==0) ? '<tr>' : '';
                        $thumb = $img->getThumbnail( 120, 120 );
-                       if ( !$thumb && $wgIgnoreImageErrors ) {
-                               $thumb = $img->iconThumb();
-                       }
                        if ( $thumb ) {
                                $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
                                $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';