Configure extension:
authorAndrew Garrett <werdna@users.mediawiki.org>
Sat, 15 Nov 2008 01:29:52 +0000 (01:29 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Sat, 15 Nov 2008 01:29:52 +0000 (01:29 +0000)
* Let users enter an image name for the logo, and then click a button to have it converted to a thumbnail URL.

includes/AjaxFunctions.php
includes/DefaultSettings.php

index 2468909..9ee3545 100644 (file)
@@ -126,3 +126,18 @@ function wfAjaxWatch($pagename = "", $watch = "") {
                return '<u#>'.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
index 354712d..d0f918d 100644 (file)
@@ -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.