r80381 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80380‎ | r80381 | r80382 >
Date:11:20, 15 January 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Add width parameter to Special:Filepath to allow getting the file path of a thumbnail. Requested by Krinkle for his Wordpress plugin (PhotoCommons)
Modified paths:
  • /trunk/phase3/includes/specials/SpecialFilepath.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialFilepath.php
@@ -47,7 +47,16 @@
4848 } else {
4949 $file = wfFindFile( $title );
5050 if ( $file && $file->exists() ) {
51 - $wgOut->redirect( $file->getURL() );
 51+ $url = $file->getURL();
 52+ $width = $wgRequest->getInt( 'width', -1 );
 53+ $height = $wgRequest->getInt( 'height', -1 );
 54+ if ( $width != -1 ) {
 55+ $mto = $file->transform( array( 'width' => $width, 'height' => $height ) );
 56+ if ( $mto && !$mto->isError() ) {
 57+ $url = $mto->getURL();
 58+ }
 59+ }
 60+ $wgOut->redirect( $url );
5261 } else {
5362 $wgOut->setStatusCode( 404 );
5463 $this->showForm( $title );

Follow-up revisions

RevisionCommit summaryAuthorDate
r803831.16wmf4: MFT r80381catrope11:36, 15 January 2011
r80544Quick adjustments to the if-block layout in r80381 to make the way the code w...werdna01:03, 19 January 2011
r805501.17: MFT r80106, r80137, r80138, r80205, r80210, r80222, r80223, r80231, r80...catrope02:09, 19 January 2011
r80667Nicing up some loose ends + Storing title instead of fullpagename (BREAKING C...krinkle00:17, 21 January 2011
r80813Bug 26870 - add width/height param to {{filepath:}}...krinkle13:09, 23 January 2011
r80814update RELEASE-NOTES for r80813 and r80381krinkle13:15, 23 January 2011

Comments

#Comment by Krinkle (talk | contribs)   12:35, 16 January 2011

Thanks

#Comment by Krinkle (talk | contribs)   08:43, 19 January 2011

I was about to document this new parameter but I came to the conclusion that (unless I'm looking in the wrong direction) we're a little short on Special-page documentation...


/me notes down..

#Comment by Krinkle (talk | contribs)   08:47, 19 January 2011

/me writes down to not blend writing down and noting.

Status & tagging log