* (bug 13214) <gallery> doesn't resize images which are smaller than 120*120
authorHuji <huji@users.mediawiki.org>
Sun, 2 Mar 2008 22:34:51 +0000 (22:34 +0000)
committerHuji <huji@users.mediawiki.org>
Sun, 2 Mar 2008 22:34:51 +0000 (22:34 +0000)
RELEASE-NOTES
includes/ImageGallery.php

index c6ae9bc..83de22b 100644 (file)
@@ -61,6 +61,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 11561) Fix fatal error when calling action=revert to non-image page
 * (bug 12430) Fix call to private method LinkFilter::makeRegex fatal error in
   maintenance/cleanupSpam.php
+* (bug 13214) <gallery> doesn't resize images which are smaller than 120*120
 
 === API changes in 1.13 ===
 
index 46ecd16..f0aec76 100644 (file)
@@ -235,7 +235,6 @@ class ImageGallery
                if( $this->mCaption )
                        $s .= "\n\t<caption>{$this->mCaption}</caption>";
 
-               $params = array( 'width' => $this->mWidths, 'height' => $this->mHeights );
                $i = 0;
                foreach ( $this->mImages as $pair ) {
                        $nt = $pair[0];
@@ -246,6 +245,12 @@ class ImageGallery
                        wfRunHooks( 'BeforeGalleryFindFile', array( &$this, &$nt, &$time ) );
 
                        $img = wfFindFile( $nt, $time );
+                       
+                       if ( $this->mWidths > $img->getWidth() && $this->mHeights > $img->getHeight()  ) {
+                               $params = array( 'width' => $img->getWidth(), 'height' => $img->getHeight() );
+                       } else {
+                               $params = array( 'width' => $this->mWidths, 'height' => $this->mHeights );
+                       }                       
 
                        if( $nt->getNamespace() != NS_IMAGE || !$img ) {
                                # We're dealing with a non-image, spit out the name and be done with it.