Prevent division-by-zero-errors. BUG#1007562
authorJens Frank <jeluf@users.mediawiki.org>
Wed, 11 Aug 2004 22:24:06 +0000 (22:24 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Wed, 11 Aug 2004 22:24:06 +0000 (22:24 +0000)
includes/Skin.php

index 12aec53..712fa9e 100644 (file)
@@ -1891,13 +1891,20 @@ class Skin {
                $alt = preg_replace( '/<[^>]*>/', '', $label);
                $alt = htmlspecialchars( $alt );
 
+               $width = $height = 0;
                if ( $img->exists() )
                {
                        $width  = $img->getWidth();
                        $height = $img->getHeight();
-               } else {
+               }
+               if ( 0 == $width || 0 == $height )
+               {
                        $width = $height = 200;
                }
+               if ( $boxwidth == 0 )
+               {
+                       $boxwidth = 200;
+               }
                if ( $framed )
                {
                        // Use image dimensions, don't scale