From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/specials/SpecialFilepath.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'includes/specials/SpecialFilepath.php') diff --git a/includes/specials/SpecialFilepath.php b/includes/specials/SpecialFilepath.php index 8bb0890c..08f90fd2 100644 --- a/includes/specials/SpecialFilepath.php +++ b/includes/specials/SpecialFilepath.php @@ -40,19 +40,25 @@ class SpecialFilepath extends SpecialPage { $file = !is_null( $par ) ? $par : $wgRequest->getText( 'file' ); - $title = Title::makeTitleSafe( NS_FILE, $file ); + $title = Title::newFromText( $file, NS_FILE ); if ( ! $title instanceof Title || $title->getNamespace() != NS_FILE ) { $this->showForm( $title ); } else { $file = wfFindFile( $title ); + if ( $file && $file->exists() ) { + // Default behaviour: Use the direct link to the file. $url = $file->getURL(); $width = $wgRequest->getInt( 'width', -1 ); $height = $wgRequest->getInt( 'height', -1 ); + + // If a width is requested... if ( $width != -1 ) { $mto = $file->transform( array( 'width' => $width, 'height' => $height ) ); + // ... and we can if ( $mto && !$mto->isError() ) { + // ... change the URL to point to a thumbnail. $url = $mto->getURL(); } } @@ -64,6 +70,9 @@ class SpecialFilepath extends SpecialPage { } } + /** + * @param $title Title + */ function showForm( $title ) { global $wgOut, $wgScript; -- cgit v1.2.3-54-g00ecf