From: Andrew Garrett Date: Sat, 15 Nov 2008 01:29:52 +0000 (+0000) Subject: Configure extension: X-Git-Tag: 1.31.0-rc.0~44333 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=f5cccb67a84f9aec51e5e383d72ae900988850fb;p=lhc%2Fweb%2Fwiklou.git Configure extension: * Let users enter an image name for the logo, and then click a button to have it converted to a thumbnail URL. --- diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index 2468909d65..9ee354534c 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -126,3 +126,18 @@ function wfAjaxWatch($pagename = "", $watch = "") { return ''.wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() ); } } + +/** + * Called in some places (currently just extensions) + * to get the thumnail URL for a given file at a given resolution. + */ +function wfAjaxGetThumbnailUrl( $file, $width, $height ) { + $file = wfFindFile( $file ); + + if ( !$file || !$file->exists() ) + return null; + + $url = $file->getThumbnail( $width, $height )->url; + + return $url; +} \ No newline at end of file diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 354712d78c..d0f918d0ba 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3301,7 +3301,7 @@ $wgUseAjax = true; * List of Ajax-callable functions. * Extensions acting as Ajax callbacks must register here */ -$wgAjaxExportList = array( ); +$wgAjaxExportList = array( 'wfAjaxGetThumbnailUrl' ); /** * Enable watching/unwatching pages using AJAX.