Get image gallery playing nice with missing image files
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 5 Dec 2004 19:14:31 +0000 (19:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 5 Dec 2004 19:14:31 +0000 (19:14 +0000)
includes/ImageGallery.php
languages/Language.php

index 8184ce4..2b33d54 100644 (file)
@@ -93,8 +93,17 @@ class ImageGallery
                        //TODO
                        //$ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
 
-                       $nb = $this->mShowBytes ? 
-                               wfMsg( "nbytes", $wgLang->formatNum( $img->getSize() ) )  . '<br />' :
+                       if( $this->mShowBytes ) {
+                               if( $img->exists() ) {
+                                       $nb = wfMsg( 'nbytes', $wgLang->formatNum( $img->getSize() ) );
+                               } else {
+                                       $nb = wfMsg( 'filemissing' );
+                               }
+                               $nb = htmlspecialchars( $nb ) . '<br />';
+                       } else {
+                               $nb = '';
+                       }
+                               
                                '' ;
                        $textlink = $this->mShowFilename ?
                                $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . '<br />' :
index 98abf3c..6e086b3 100644 (file)
@@ -1452,6 +1452,7 @@ article [[Train]].
 
 'thumbnail-more'       => 'Enlarge',
 'missingimage'         => "<b>Missing image</b><br /><i>$1</i>\n",
+'filemissing'          => 'File missing',
 
 # Special:Import
 'import'       => 'Import pages',