From 6c799e62aa8be2db1c071dd0828c6973a6917962 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 5 Dec 2004 19:14:31 +0000 Subject: [PATCH] Get image gallery playing nice with missing image files --- includes/ImageGallery.php | 13 +++++++++++-- languages/Language.php | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 8184ce4987..2b33d54e01 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -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() ) ) . '
' : + if( $this->mShowBytes ) { + if( $img->exists() ) { + $nb = wfMsg( 'nbytes', $wgLang->formatNum( $img->getSize() ) ); + } else { + $nb = wfMsg( 'filemissing' ); + } + $nb = htmlspecialchars( $nb ) . '
'; + } else { + $nb = ''; + } + '' ; $textlink = $this->mShowFilename ? $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . '
' : diff --git a/languages/Language.php b/languages/Language.php index 98abf3cf39..6e086b3f7b 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1452,6 +1452,7 @@ article [[Train]]. 'thumbnail-more' => 'Enlarge', 'missingimage' => "Missing image
$1\n", +'filemissing' => 'File missing', # Special:Import 'import' => 'Import pages', -- 2.20.1