Index: trunk/phase3/includes/specials/SpecialFilepath.php |
— | — | @@ -46,19 +46,21 @@ |
47 | 47 | $this->showForm( $title ); |
48 | 48 | } else { |
49 | 49 | $file = wfFindFile( $title ); |
| 50 | + |
50 | 51 | if ( $file && $file->exists() ) { |
| 52 | + // Default behaviour: Use the direct link to the file. |
| 53 | + $url = $file->getURL(); |
51 | 54 | $width = $wgRequest->getInt( 'width', -1 ); |
52 | 55 | $height = $wgRequest->getInt( 'height', -1 ); |
53 | 56 | |
54 | 57 | if ( $width != -1 ) { |
| 58 | + // If we can, and it's requested, |
| 59 | + // change the URL to point to a thumbnail. |
55 | 60 | $mto = $file->transform( array( 'width' => $width, 'height' => $height ) ); |
56 | 61 | if ( $mto && !$mto->isError() ) { |
57 | 62 | $url = $mto->getURL(); |
58 | 63 | } |
59 | | - } else { |
60 | | - $url = $file->getURL(); |
61 | 64 | } |
62 | | - |
63 | 65 | $wgOut->redirect( $url ); |
64 | 66 | } else { |
65 | 67 | $wgOut->setStatusCode( 404 ); |