From d1647fe4ac03cc8f0ca7efbd1cd72d2650c30f0c Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 2 Feb 2013 12:29:49 +0100 Subject: [PATCH] Show no size links on image pages with errors This avoids useless "Size of this preview: . Other resolutions: | | | ." on image pages. Change-Id: Ieb2787a736ec5ae409ad17dd9919f4975f0b843e --- includes/ImagePage.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index a54bd92143..3d70fa5ca7 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -369,12 +369,19 @@ class ImagePage extends Article { if ( $size[0] < $width_orig && $size[1] < $height_orig && $size[0] != $width && $size[1] != $height ) { - $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] ); + $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] ); + if ( $sizeLink ) { + $otherSizes[] = $sizeLink; + } } } - $msgsmall = wfMessage( 'show-big-image-preview' )-> - rawParams( $this->makeSizeLink( $params, $width, $height ) )-> - parse(); + $msgsmall = ''; + $sizeLinkBigImagePreview = $this->makeSizeLink( $params, $width, $height ); + if ( $sizeLinkBigImagePreview ) { + $msgsmall .= wfMessage( 'show-big-image-preview' )-> + rawParams( $sizeLinkBigImagePreview )-> + parse(); + } if ( count( $otherSizes ) ) { $msgsmall .= ' ' . Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ), -- 2.20.1