From 7de32afa9ae90941505558328341ca285f73c59a Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Fri, 25 May 2007 16:32:46 +0000 Subject: [PATCH] Introducing 'frameless' keyword to [[Image:]] syntax which respects the user preferences for image width like 'thumb' but without a frame. Now we can use frameless images without the need to nailing its size by a constant pixel parameter. Scaling by different user preference/anon view will always keep the proportions. Usage: [[Image:name.jpg|frameless|right]] --- RELEASE-NOTES | 8 +++++--- includes/Linker.php | 4 ++-- includes/Parser.php | 7 ++++++- languages/messages/MessagesEn.php | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8928784580..695f60f358 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -34,13 +34,15 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9628) Show warnings about slave lag on Special:Contributions, Special:Watchlist * (bug 8818) Expose "wpDestFile" as parameter $1 to "uploaddisabledtext" -* Introducing new image parameter 'upright' and corresponding variable +* Introducing new image keyword 'upright' and corresponding variable $wgThumbUpright. This allows better proportional view of upright images related to landscape images on a page without nailing the width of upright images to a fix value which makes views for anon unproportional and user preferences useless -* (bug 6072) Add a 'border' keyword to the image syntax - +* (bug 6072) Introducing 'border' keyword to the [[Image:]] syntax +* Introducing 'frameless' keyword to [[Image:]] syntax which respects the + user preferences for image width like 'thumb' but without a frame. + == Bugfixes since 1.10 == * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi diff --git a/includes/Linker.php b/includes/Linker.php index 1f3494b5bb..e7a776cf76 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -414,7 +414,7 @@ class Linker { /** @todo document */ function makeImageLinkObj( $nt, $label, $alt, $align = '', $params = array(), $framed = false, - $thumb = false, $manual_thumb = '', $valign = '', $upright = false, $upright_factor = 0, $border = false ) + $thumb = false, $manual_thumb = '', $valign = '', $upright = false, $upright_factor = 0, $border = false, $frameless = false ) { global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright; @@ -436,7 +436,7 @@ class Linker { if ( !isset( $params['width'] ) ) { $params['width'] = $img->getWidth( $page ); - if( $thumb || $framed ) { + if( $thumb || $framed || $frameless ) { $wopt = $wgUser->getOption( 'thumbsize' ); if( !isset( $wgThumbLimits[$wopt] ) ) { diff --git a/includes/Parser.php b/includes/Parser.php index 0a7e86260e..3f9b1d69f3 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4412,6 +4412,7 @@ class Parser # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox # * center center the image # * framed Keep original image size, no magnify-button. + # * frameless like 'thumbnail' but without frame, enlarge-icon and caption. User preference thumb width is used # * upright reduce width for upright images, rounded to full __0 px # * border draw a 1px border around the image # vertical-align values (no % or length right now): @@ -4436,6 +4437,7 @@ class Parser $mwManualThumb =& MagicWord::get( 'img_manualthumb' ); $mwWidth =& MagicWord::get( 'img_width' ); $mwFramed =& MagicWord::get( 'img_framed' ); + $mwFrameless =& MagicWord::get( 'img_frameless' ); $mwUpright =& MagicWord::get( 'img_upright' ); $mwBorder =& MagicWord::get( 'img_border' ); $mwPage =& MagicWord::get( 'img_page' ); @@ -4443,6 +4445,7 @@ class Parser $params = array(); $framed = $thumb = false; + $frameless = false; $upright = false; $upright_factor = 0; $border = false; @@ -4458,6 +4461,8 @@ class Parser $upright_factor = floatval( $match ); } elseif ( !is_null( $mwBorder->matchVariableStartToEnd( $val ) ) ) { $border = true; + } elseif ( !is_null( $mwFrameless->matchVariableStartToEnd( $val ) ) ) { + $frameless = true; } elseif ( ! is_null( $match = $mwManualThumb->matchVariableStartToEnd($val) ) ) { # use manually specified thumbnail $thumb=true; @@ -4504,7 +4509,7 @@ class Parser $alt = Sanitizer::stripAllTags( $alt ); # Linker does the rest - return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign, $upright, $upright_factor, $border ); + return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign, $upright, $upright_factor, $border, $frameless ); } /** diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index fa5edfe074..1e52559e84 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -281,6 +281,7 @@ $magicWords = array( 'img_width' => array( 1, '$1px' ), 'img_center' => array( 1, 'center', 'centre' ), 'img_framed' => array( 1, 'framed', 'enframed', 'frame' ), + 'img_frameless' => array( 1, 'frameless' ), 'img_page' => array( 1, 'page=$1', 'page $1' ), 'img_upright' => array( 1, 'upright', 'upright=$1', 'upright $1' ), 'img_border' => array( 1, 'border' ), -- 2.20.1