Fixed flow control in Image::getThumbnail()
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 4 Jul 2006 18:04:28 +0000 (18:04 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 4 Jul 2006 18:04:28 +0000 (18:04 +0000)
includes/Image.php

index 6f510f9..f9fee3d 100644 (file)
@@ -886,14 +886,13 @@ class Image
         * @public
         */
        function getThumbnail( $width, $height=-1 ) {
-               if ( $height <= 0 ) {
-                       return $this->renderThumb( $width );
-               }
-               $this->load();
-
                if ($this->canRender()) {
-                       if ( $width > $this->width * $height / $this->height )
-                               $width = wfFitBoxWidth( $this->width, $this->height, $height );
+                       if ( $height > 0 ) {
+                               $this->load();
+                               if ( $width > $this->width * $height / $this->height ) {
+                                       $width = wfFitBoxWidth( $this->width, $this->height, $height );
+                               }
+                       }
                        return $this->renderThumb( $width );
                } else {
                        // not a bitmap or renderable image, don't try.