aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Manske <magnusmanske@users.mediawiki.org>2004-07-10 17:56:27 +0000
committerMagnus Manske <magnusmanske@users.mediawiki.org>2004-07-10 17:56:27 +0000
commitb1e7ca8aac54b0918a5df751485b87b07e7ced6d (patch)
tree2297e6d3072e59aec2f7de2f70ce03175d081726
parent1b48c394e54cdc59a699622a08ea6ea2664df0de (diff)
downloadmediawikicore-b1e7ca8aac54b0918a5df751485b87b07e7ced6d.tar.gz
mediawikicore-b1e7ca8aac54b0918a5df751485b87b07e7ced6d.zip
Now with manual thumbnail option (thumb=xyz.jpg)
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/4264
-rw-r--r--includes/Skin.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/includes/Skin.php b/includes/Skin.php
index e739e97d4f18..2df5c7c2f666 100644
--- a/includes/Skin.php
+++ b/includes/Skin.php
@@ -1758,10 +1758,17 @@ class Skin {
$alt = $part[count($part)-1];
$height = $framed = $thumb = false;
+ $manual_thumb = "" ;
foreach( $part as $key => $val ) {
+ $val_parts = explode ( "=" , $val , 2 ) ;
+ $left_part = array_shift ( $val_parts ) ;
if ( ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
$thumb=true;
+ } elseif ( count ( $val_parts ) == 1 && ! is_null( $mwThumb->matchVariableStartToEnd($left_part) ) ) {
+ # use manually specified thumbnail
+ $thumb=true;
+ $manual_thumb = array_shift ( $val_parts ) ;
} elseif ( ! is_null( $mwRight->matchVariableStartToEnd($val) ) ) {
# remember to set an alignment, don't render immediately
$align = 'right';
@@ -1808,7 +1815,7 @@ class Skin {
if ( ! isset($width) ) {
$width = 180;
}
- return $prefix.$this->makeThumbLinkObj( $img, $alt, $align, $width, $height, $framed ).$postfix;
+ return $prefix.$this->makeThumbLinkObj( $img, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix;
} elseif ( isset($width) ) {
@@ -1846,7 +1853,7 @@ class Skin {
}
- function makeThumbLinkObj( $img, $label = '', $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false ) {
+ function makeThumbLinkObj( $img, $label = '', $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
global $wgStylePath, $wgLang;
# $image = Title::makeTitle( Namespace::getImage(), $name );
$url = $img->getURL();
@@ -1881,6 +1888,21 @@ class Skin {
$thumbUrl = $img->createThumb( $boxwidth );
}
+ if ( $manual_thumb != '' ) # Use manually specified thumbnail
+ {
+ $manual_title = Title::makeTitle( Namespace::getImage(), $manual_thumb ); #new Title ( $manual_thumb ) ;
+ $manual_img = Image::newFromTitle( $manual_title );
+ $thumbUrl = $manual_img->getURL();
+ if ( $manual_img->exists() )
+ {
+ $width = $manual_img->getWidth();
+ $height = $manual_img->getHeight();
+ $boxwidth = $width ;
+ $boxheight = $height ;
+ $oboxwidth = $boxwidth + 2 ;
+ }
+ }
+
$u = $img->getEscapeLocalURL();
$more = htmlspecialchars( wfMsg( 'thumbnail-more' ) );