- $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
- $thumbhtml = "\n\t\t\t".'<div class="thumb" style="padding: ' . $vpad . 'px 0; width: '.($this->mWidths+30).'px;">'
- . $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div>';
+ # We get layout problems with the margin, if the image is smaller
+ # than the line-height (17), so we add less margin in these cases.
+ $minThumbHeight = $thumb->height > 17 ? $thumb->height : 17;
+ $vpad = floor(( self::THUMB_PADDING + $this->mHeights - $minThumbHeight ) /2);
+
+
+ $imageParameters = array(
+ 'desc-link' => true,
+ 'desc-query' => $descQuery,
+ 'alt' => $alt,
+ );
+ # In the absence of both alt text and caption, fall back on providing screen readers with the filename as alt text
+ if ( $alt == '' && $text == '' ) {
+ $imageParameters['alt'] = $nt->getText();
+ }
+
+ # Set both fixed width and min-height.
+ $thumbhtml = "\n\t\t\t".
+ '<div class="thumb" style="width: ' .($this->mWidths + self::THUMB_PADDING).'px;">'
+ # 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 <img> tags.
+ # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
+ . '<div style="margin:'.$vpad.'px auto;">'
+ . $thumb->toHtml( $imageParameters ) . '</div></div>';
+
+ // Call parser transform hook
+ if ( $this->mParser && $img->getHandler() ) {
+ $img->getHandler()->parserTransformHook( $this->mParser, $img );
+ }