| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -112,6 +112,8 @@ |
| 113 | 113 | * (bug 14706) Added support for the Imagick PHP extension. |
| 114 | 114 | * (bug 18691) Added support for SVG rasterization using the Imagick PHP |
| 115 | 115 | extension |
| | 116 | +* (bug 2581, bug 6834) Added links to thumbnail in several resolutions to the |
| | 117 | + file description page. The sizes are set by $wgImageLimits. |
| 116 | 118 | |
| 117 | 119 | === Bug fixes in 1.18 === |
| 118 | 120 | * (bug 23119) WikiError class and subclasses are now marked as deprecated |
| Index: trunk/phase3/languages/messages/MessagesEn.php |
| — | — | @@ -3641,7 +3641,9 @@ |
| 3642 | 3642 | 'file-nohires' => '<small>No higher resolution available.</small>', |
| 3643 | 3643 | 'svg-long-desc' => 'SVG file, nominally $1 × $2 pixels, file size: $3', |
| 3644 | 3644 | 'show-big-image' => 'Full resolution', |
| 3645 | | -'show-big-image-thumb' => '<small>Size of this preview: $1 × $2 pixels</small>', |
| | 3645 | +'show-big-image-preview' => '<small> Size of this preview: $1.</small>', |
| | 3646 | +'show-big-image-other' => '<small>Other resolutions: $1.</small>', |
| | 3647 | +'show-big-image-size' => '$1 × $2 pixels', |
| 3646 | 3648 | 'file-info-gif-looped' => 'looped', |
| 3647 | 3649 | 'file-info-gif-frames' => '$1 {{PLURAL:$1|frame|frames}}', |
| 3648 | 3650 | 'file-info-png-looped' => 'looped', |
| Index: trunk/phase3/includes/ImagePage.php |
| — | — | @@ -360,16 +360,25 @@ |
| 361 | 361 | # because of rounding. |
| 362 | 362 | } |
| 363 | 363 | $msgbig = wfMsgHtml( 'show-big-image' ); |
| 364 | | - $msgsmall = wfMsgExt( 'show-big-image-thumb', 'parseinline', |
| 365 | | - $wgLang->formatNum( $width ), |
| 366 | | - $wgLang->formatNum( $height ) |
| 367 | | - ); |
| | 364 | + $otherSizes = array(); |
| | 365 | + foreach ( $wgImageLimits as $size ) { |
| | 366 | + if ( $size[0] < $width_orig && $size[1] < $height_orig && |
| | 367 | + $size[0] != $width && $size[1] != $height ) { |
| | 368 | + $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] ); |
| | 369 | + } |
| | 370 | + } |
| | 371 | + $msgsmall = wfMessage( 'show-big-image-preview' )-> |
| | 372 | + rawParams( $this->makeSizeLink( $params, $width, $height ) )-> |
| | 373 | + parse() . ' ' . |
| | 374 | + wfMessage( 'show-big-image-other' )-> |
| | 375 | + rawParams( $wgLang->pipeList( $otherSizes ) )->parse(); |
| 368 | 376 | } else { |
| 369 | 377 | # Image is small enough to show full size on image page |
| 370 | 378 | $msgsmall = wfMsgExt( 'file-nohires', array( 'parseinline' ) ); |
| 371 | 379 | } |
| 372 | 380 | |
| 373 | 381 | $params['width'] = $width; |
| | 382 | + $params['height'] = $height; |
| 374 | 383 | $thumbnail = $this->displayImg->transform( $params ); |
| 375 | 384 | |
| 376 | 385 | $showLink = true; |
| — | — | @@ -515,6 +524,30 @@ |
| 516 | 525 | } |
| 517 | 526 | } |
| 518 | 527 | } |
| | 528 | + |
| | 529 | + /** |
| | 530 | + * Creates an thumbnail of specified size and returns an HTML link to it |
| | 531 | + * @param array $params Scaler parameters |
| | 532 | + * @param int $width |
| | 533 | + * @param int $height |
| | 534 | + */ |
| | 535 | + private function makeSizeLink( $params, $width, $height ) { |
| | 536 | + global $wgLang; |
| | 537 | + |
| | 538 | + $params['width'] = $width; |
| | 539 | + $params['height'] = $height; |
| | 540 | + $thumbnail = $this->displayImg->transform( $params ); |
| | 541 | + if ( $thumbnail && !$thumbnail->isError() ) { |
| | 542 | + return Html::rawElement( 'a', array( |
| | 543 | + 'href' => $thumbnail->getUrl(), |
| | 544 | + 'class' => 'mw-thumbnail-link' |
| | 545 | + ), wfMessage( 'show-big-image-size' )->numParams( |
| | 546 | + $thumbnail->getWidth(), $thumbnail->getHeight() |
| | 547 | + )->parse() ); |
| | 548 | + } else { |
| | 549 | + return ''; |
| | 550 | + } |
| | 551 | + } |
| 519 | 552 | |
| 520 | 553 | /** |
| 521 | 554 | * Show a notice that the file is from a shared repository |
| Index: trunk/phase3/maintenance/language/messages.inc |
| — | — | @@ -2589,7 +2589,9 @@ |
| 2590 | 2590 | 'file-nohires', |
| 2591 | 2591 | 'svg-long-desc', |
| 2592 | 2592 | 'show-big-image', |
| 2593 | | - 'show-big-image-thumb', |
| | 2593 | + 'show-big-image-preview', |
| | 2594 | + 'show-big-image-other', |
| | 2595 | + 'show-big-image-size', |
| 2594 | 2596 | 'file-info-gif-looped', |
| 2595 | 2597 | 'file-info-gif-frames', |
| 2596 | 2598 | 'file-info-png-looped', |