Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -584,11 +584,6 @@ |
585 | 585 | margin: 2px; |
586 | 586 | } |
587 | 587 | |
588 | | -li.gallerybox div.thumb img { |
589 | | - display: block; |
590 | | - margin: 0 auto; |
591 | | -} |
592 | | - |
593 | 588 | div.gallerytext { |
594 | 589 | overflow: hidden; |
595 | 590 | font-size: 94%; |
Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -7465,14 +7465,14 @@ |
7466 | 7466 | !! result |
7467 | 7467 | <ul class="gallery"> |
7468 | 7468 | <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
7469 | | - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 7469 | + <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
7470 | 7470 | <div class="gallerytext"> |
7471 | 7471 | <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/3/3a/Foobar.jpg" width="20" height="2" /></a> |
7472 | 7472 | </p> |
7473 | 7473 | </div> |
7474 | 7474 | </div></li> |
7475 | 7475 | <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
7476 | | - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 7476 | + <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
7477 | 7477 | <div class="gallerytext"> |
7478 | 7478 | <p>This is a test template |
7479 | 7479 | </p> |
— | — | @@ -7509,7 +7509,7 @@ |
7510 | 7510 | </div> |
7511 | 7511 | </div></li> |
7512 | 7512 | <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
7513 | | - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 7513 | + <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
7514 | 7514 | <div class="gallerytext"> |
7515 | 7515 | <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
7516 | 7516 | some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
— | — | @@ -7517,7 +7517,7 @@ |
7518 | 7518 | </div> |
7519 | 7519 | </div></li> |
7520 | 7520 | <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
7521 | | - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 7521 | + <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
7522 | 7522 | <div class="gallerytext"> |
7523 | 7523 | <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
7524 | 7524 | </p> |
— | — | @@ -7549,12 +7549,12 @@ |
7550 | 7550 | </div> |
7551 | 7551 | </div></li> |
7552 | 7552 | <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
7553 | | - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 7553 | + <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
7554 | 7554 | <div class="gallerytext"> |
7555 | 7555 | </div> |
7556 | 7556 | </div></li> |
7557 | 7557 | <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
7558 | | - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 7558 | + <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
7559 | 7559 | <div class="gallerytext"> |
7560 | 7560 | </div> |
7561 | 7561 | </div></li> |
Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -281,7 +281,10 @@ |
282 | 282 | $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">' |
283 | 283 | . htmlspecialchars( $img->getLastError() ) . '</div>'; |
284 | 284 | } else { |
285 | | - $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /2; |
| 285 | + # We get layout problems with the margin, if the image is smaller |
| 286 | + # than the line-height (17), so we add less margin in these cases. |
| 287 | + $minThumbHeight = $thumb->height > 17 ? $thumb->height : 17; |
| 288 | + $vpad = floor( ( self::THUMB_PADDING + $this->mHeights - $minThumbHeight ) /2 ); |
286 | 289 | |
287 | 290 | $imageParameters = array( |
288 | 291 | 'desc-link' => true, |