r53287 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53286‎ | r53287 | r53288 >
Date:04:18, 15 July 2009
Author:rememberthedot
Status:resolved
Tags:
Comment:
Applied image attribute improvements from r52726 to galleries as well
Modified paths:
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImageGallery.php
@@ -236,7 +236,7 @@
237237 $i = 0;
238238 foreach ( $this->mImages as $pair ) {
239239 $nt = $pair[0];
240 - $text = $pair[1];
 240+ $text = $pair[1]; # "text" means "caption" here
241241
242242 # Give extensions a chance to select the file revision for us
243243 $time = $descQuery = false;
@@ -265,6 +265,15 @@
266266 . htmlspecialchars( $img->getLastError() ) . '</div>';
267267 } else {
268268 $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
 269+
 270+ $imageParameters = array(
 271+ 'desc-link' => true,
 272+ 'desc-query' => $descQuery
 273+ );
 274+ # In the absence of a caption, fall back on providing screen readers with the filename as alt text
 275+ if ( $text == '' ) {
 276+ $imageParameters['alt'] = $nt->getText();
 277+ }
269278
270279 $thumbhtml = "\n\t\t\t".
271280 '<div class="thumb" style="padding: ' . $vpad . 'px 0; width: ' .($this->mWidths+30).'px;">'
@@ -272,7 +281,7 @@
273282 # handlers since they may emit block-level elements as opposed to simple <img> tags.
274283 # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
275284 . '<div style="margin-left: auto; margin-right: auto; width: ' .$this->mWidths.'px;">'
276 - . $thumb->toHtml( array( 'desc-link' => true, 'desc-query' => $descQuery ) ) . '</div></div>';
 285+ . $thumb->toHtml( $imageParameters ) . '</div></div>';
277286
278287 // Call parser transform hook
279288 if ( $this->mParser && $img->getHandler() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r53288Updated parser test for r52726 and r53287rememberthedot04:19, 15 July 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52726Title attributes are now always blank on framed and thumbnailed images, and d...rememberthedot05:13, 3 July 2009

Status & tagging log