From bb84043024456a910badcd43cc604c80be7bff94 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Sun, 5 Dec 2010 22:41:06 +0000 Subject: [PATCH] Follow up to r77411. Patch by DieBuche 1. Adds a line css to actually fix Bug 3770 (Sorry, I had forgotten to paste it there as well) 2. Fixes a problem, where the box size would be slighty higher if the image thumb has a height of less than 8px 3. Normalize the calculation of the vertical padding to be exactly the same one as the horizontal padding. (This is only relevant for unusually large galleries, eg. previously it returned a not-exactly-square box if you specified 500px as both width and height) --- includes/ImageGallery.php | 16 +++++++++------- skins/common/shared.css | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 31821d4a76..b12648c2aa 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -257,11 +257,11 @@ class ImageGallery if( !$img ) { # We're dealing with a non-image, spit out the name and be done with it. - $thumbhtml = "\n\t\t\t".'
' + $thumbhtml = "\n\t\t\t".'
' . htmlspecialchars( $nt->getText() ) . '
'; } elseif( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) { # The image is blacklisted, just show it as a text link. - $thumbhtml = "\n\t\t\t".'
' . + $thumbhtml = "\n\t\t\t".'
' . $sk->link( $nt, htmlspecialchars( $nt->getText() ), @@ -272,10 +272,10 @@ class ImageGallery '
'; } elseif( !( $thumb = $img->transform( $params ) ) ) { # Error generating thumbnail. - $thumbhtml = "\n\t\t\t".'
' + $thumbhtml = "\n\t\t\t".'
' . htmlspecialchars( $img->getLastError() ) . '
'; } else { - $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2; + $vpad = floor(( 30 + $this->mHeights - $thumb->height ) /2); $imageParameters = array( 'desc-link' => true, @@ -285,13 +285,15 @@ class ImageGallery if ( $text == '' ) { $imageParameters['alt'] = $nt->getText(); } - + + # Set both fixed width and height. Otherwise we might have problems + # with the vertical centering of images where height' + '
' # Auto-margin centering for block-level elements. Needed now that we have video # handlers since they may emit block-level elements as opposed to simple tags. # ref http://css-discuss.incutio.com/?page=CenteringBlockElement - . '
' + . '
' . $thumb->toHtml( $imageParameters ) . '
'; // Call parser transform hook diff --git a/skins/common/shared.css b/skins/common/shared.css index e64609ebe0..b64e6c3cca 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -823,6 +823,7 @@ div.gallerytext { overflow: hidden; font-size: 94%; padding: 2px 4px; + word-wrap: break-word; } table.mw-enhanced-rc { -- 2.20.1