From: Remember the dot Date: Wed, 15 Jul 2009 04:18:16 +0000 (+0000) Subject: Applied image attribute improvements from r52726 to galleries as well X-Git-Tag: 1.31.0-rc.0~40940 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=700bcb30b01301e9fb804ef1b1f13cbadcb44911;p=lhc%2Fweb%2Fwiklou.git Applied image attribute improvements from r52726 to galleries as well --- diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 3228b5901a..987d76ad1c 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -236,7 +236,7 @@ class ImageGallery $i = 0; foreach ( $this->mImages as $pair ) { $nt = $pair[0]; - $text = $pair[1]; + $text = $pair[1]; # "text" means "caption" here # Give extensions a chance to select the file revision for us $time = $descQuery = false; @@ -265,6 +265,15 @@ class ImageGallery . htmlspecialchars( $img->getLastError() ) . ''; } else { $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2; + + $imageParameters = array( + 'desc-link' => true, + 'desc-query' => $descQuery + ); + # In the absence of a caption, fall back on providing screen readers with the filename as alt text + if ( $text == '' ) { + $imageParameters['alt'] = $nt->getText(); + } $thumbhtml = "\n\t\t\t". '
' @@ -272,7 +281,7 @@ class ImageGallery # handlers since they may emit block-level elements as opposed to simple tags. # ref http://css-discuss.incutio.com/?page=CenteringBlockElement . '
' - . $thumb->toHtml( array( 'desc-link' => true, 'desc-query' => $descQuery ) ) . '
'; + . $thumb->toHtml( $imageParameters ) . ''; // Call parser transform hook if ( $this->mParser && $img->getHandler() ) {