From: Antoine Musso Date: Wed, 20 Dec 2006 14:24:57 +0000 (+0000) Subject: Fix 8335 : Image syntax does not parse "px" in image caption correctly X-Git-Tag: 1.31.0-rc.0~54832 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=d0183a2a801d8d4b128336ff57a7cf3ffaf9a939;p=lhc%2Fweb%2Fwiklou.git Fix 8335 : Image syntax does not parse "px" in image caption correctly --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ba81800d6f..b52c3f8ec0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -363,6 +363,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN automatically logs the user in with the new password after changing it; pulling from slave meant the record was often not the updated one. +* (bug 8335) Set image width to the first valid parameter found. == Languages updated == diff --git a/includes/Parser.php b/includes/Parser.php index 97a1f13ae6..1642105916 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4407,15 +4407,15 @@ class Parser && ! is_null( $match = $mwPage->matchVariableStartToEnd($val) ) ) { # Select a page in a multipage document $page = $match; - } elseif ( $wgUseImageResize && ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) { + } elseif ( $wgUseImageResize && !$width && ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) { wfDebug( "img_width match: $match\n" ); # $match is the image width in pixels $m = array(); - if ( preg_match( '/^([0-9]*)x([0-9]*)$/', $match, $m ) ) { + if ( is_numeric($match) ) { + $width = intval($match); + } elseif ( preg_match( '/^([0-9]*)x([0-9]*)$/', $match, $m ) ) { $width = intval( $m[1] ); $height = intval( $m[2] ); - } else { - $width = intval($match); } } elseif ( ! is_null( $mwFramed->matchVariableStartToEnd($val) ) ) { $framed=true;