Index: trunk/phase3/includes/Linker.php |
— | — | @@ -433,6 +433,7 @@ |
434 | 434 | * to transform(). Typical keys are "width" and "page". |
435 | 435 | * @param $time String: timestamp of the file, set as false for current |
436 | 436 | * @param $query String: query params for desc url |
| 437 | + * @param $widthOption: Used by the parser to remember the user preference thumbnailsize |
437 | 438 | * @return String: HTML for an image, with links, wrappers, etc. |
438 | 439 | */ |
439 | 440 | function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "", $widthOption = null ) { |
— | — | @@ -442,7 +443,6 @@ |
443 | 444 | return $res; |
444 | 445 | } |
445 | 446 | |
446 | | - global $wgContLang, $wgThumbLimits, $wgThumbUpright; |
447 | 447 | if ( $file && !$file->allowInlineDisplay() ) { |
448 | 448 | wfDebug( __METHOD__ . ': ' . $title->getPrefixedDBkey() . " does not allow inline display\n" ); |
449 | 449 | return $this->link( $title ); |
— | — | @@ -469,28 +469,31 @@ |
470 | 470 | $hp['width'] = $file->getWidth( $page ); |
471 | 471 | |
472 | 472 | if ( isset( $fp['thumbnail'] ) || isset( $fp['framed'] ) || isset( $fp['frameless'] ) || !$hp['width'] ) { |
| 473 | + global $wgThumbLimits, $wgThumbUpright; |
473 | 474 | if ( !isset( $widthOption ) || !isset( $wgThumbLimits[$widthOption] ) ) { |
474 | | - $widthOption = User::getDefaultOption( 'thumbsize' ); |
| 475 | + $widthOption = User::getDefaultOption( 'thumbsize' ); |
475 | 476 | } |
476 | 477 | |
477 | 478 | // Reduce width for upright images when parameter 'upright' is used |
478 | 479 | if ( isset( $fp['upright'] ) && $fp['upright'] == 0 ) { |
479 | 480 | $fp['upright'] = $wgThumbUpright; |
480 | 481 | } |
481 | | - // Use width which is smaller: real image width or user preference width |
482 | 482 | // For caching health: If width scaled down due to upright parameter, round to full __0 pixel to avoid the creation of a lot of odd thumbs |
483 | 483 | $prefWidth = isset( $fp['upright'] ) ? |
484 | 484 | round( $wgThumbLimits[$widthOption] * $fp['upright'], -1 ) : |
485 | 485 | $wgThumbLimits[$widthOption]; |
486 | | - if ( $hp['width'] <= 0 || $prefWidth < $hp['width'] ) { |
487 | | - if ( !isset( $hp['height'] ) ) { |
488 | | - $hp['width'] = $prefWidth; |
489 | | - } |
| 486 | + |
| 487 | + // Use width which is smaller: real image width or user preference width |
| 488 | + // Unless image is scalable vector. |
| 489 | + if ( !isset( $hp['height'] ) && ( $hp['width'] <= 0 || |
| 490 | + $prefWidth < $hp['width'] || $file->isVectorized() ) ) { |
| 491 | + $hp['width'] = $prefWidth; |
490 | 492 | } |
491 | 493 | } |
492 | 494 | } |
493 | 495 | |
494 | | - if ( isset( $fp['thumbnail'] ) || isset( $fp['manualthumb'] ) || isset( $fp['framed'] ) ) { |
| 496 | + if ( $file && ( isset( $fp['thumbnail'] ) || isset( $fp['manualthumb'] ) || isset( $fp['framed'] ) ) ) { |
| 497 | + global $wgContLang; |
495 | 498 | # Create a thumbnail. Alignment depends on language |
496 | 499 | # writing direction, # right aligned for left-to-right- |
497 | 500 | # languages ("Western languages"), left-aligned |
— | — | @@ -513,7 +516,7 @@ |
514 | 517 | } |
515 | 518 | } |
516 | 519 | |
517 | | - if ( $file && $hp['width'] ) { |
| 520 | + if ( $file && isset( $hp['width'] ) ) { |
518 | 521 | # Create a resized image, without the additional thumbnail features |
519 | 522 | $thumb = $file->transform( $hp ); |
520 | 523 | } else { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -379,6 +379,7 @@ |
380 | 380 | * (bug 23731) Clarified "n links" message on Special:MostLinkedTemplates |
381 | 381 | * (bug 25642) A exception is now thrown instead of a fatal error when using |
382 | 382 | $wgSMTP without PEAR mail package |
| 383 | +* (bug 19633) When possible, Upscale small SVGs when creating thumbnails. |
383 | 384 | |
384 | 385 | === API changes in 1.17 === |
385 | 386 | * (bug 22738) Allow filtering by action type on query=logevent. |