Fixed problem with image pages of non existing images
authorJens Frank <jeluf@users.mediawiki.org>
Fri, 16 Jan 2004 18:11:47 +0000 (18:11 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Fri, 16 Jan 2004 18:11:47 +0000 (18:11 +0000)
includes/ImagePage.php
includes/Skin.php

index c883bf7..e644549 100644 (file)
@@ -30,18 +30,20 @@ class ImagePage extends Article {
                $name = $this->mTitle->getText();
                $path = wfImagePath( $name );
                $url   = wfImageUrl( $name );
-               
-               list($width, $height, $type, $attr) = getimagesize( $path );
 
-               $sk = $wgUser->getSkin();
+               if ( file_exists( $path ) ) {
+                       list($width, $height, $type, $attr) = getimagesize( $path );
 
-               if ( $type != "" ) {
-                       # image
-                       $s .= "<center><img src=\"{$url}\" width=\"{$width}\" height=\"{$height}\"></center>";
-               } else {
-                       $s .= "<center>".$sk->makeMediaLink($name,"")."</center>";
+                       $sk = $wgUser->getSkin();
+
+                       if ( $type != "" ) {
+                               # image
+                               $s .= "<center><img src=\"{$url}\" width=\"{$width}\" height=\"{$height}\"></center>";
+                       } else {
+                               $s .= "<center>".$sk->makeMediaLink($name,"")."</center>";
+                       }
+                       $wgOut->AddHTML( $s );
                }
-               $wgOut->AddHTML( $s );
        }
        
        function closeShowImage()
index 1211182..e0416f4 100644 (file)
@@ -1515,7 +1515,7 @@ class Skin {
                $thumbPath = wfImageArchiveDir( $thumbName, "thumb" )."/".$thumbName;
                $thumbUrl  = wfImageArchiveUrl( $thumbName, "thumb" );
 
-               if (     (! file_exists( $thumbPath )) 
+               if (     (! file_exists( $thumbPath ) && file_exists( $imgPath )
                     ||  ( filemtime($thumbPath) < filemtime($imgPath) ) ) {
                        if ( $wgUseImageMagick ) {
                                # use ImageMagick