r100061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100060‎ | r100061 | r100062 >
Date:17:57, 17 October 2011
Author:btongminh
Status:ok
Tags:
Comment:
More work on vips test special page
Modified paths:
  • /trunk/extensions/VipsScaler/SpecialVipsTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/VipsScaler/SpecialVipsTest.php
@@ -20,7 +20,34 @@
2121 }
2222
2323 protected function showThumbnails() {
 24+ $request = $this->getRequest();
2425
 26+ $title = Title::makeTitleSafe( NS_FILE, $request->getText( 'file' ) );
 27+ if ( is_null( $title ) ) {
 28+ $this->getOutput()->addWikiMsg( 'vips-invalid-file' );
 29+ return;
 30+ }
 31+ $file = wfFindFile( $title );
 32+ if ( !$file || !$file->exists() ) {
 33+ $this->getOutput()->addWikiMsg( 'vips-invalid-file' );
 34+ return;
 35+ }
 36+
 37+ $width = $request->getInt( 'width' );
 38+ if ( !$width ) {
 39+ $this->getOutput()->addWikiMsg( 'vips-invalid-width' );
 40+ return;
 41+ }
 42+
 43+ $params = array( 'width' => $width );
 44+ $thumb = $file->transform( $params );
 45+ if ( !$thumb || $thumb->isError() ) {
 46+ $this->getOutput()->addWikiMsg( 'vips-thumb-error' );
 47+ }
 48+
 49+ $vipsThumbUrl = $this->makeUrl( $file, $width );
 50+
 51+
2552 }
2653
2754 protected function showForm() {
@@ -113,7 +140,7 @@
114141 $status = $req->execute();
115142 if ( $status->isOk() ) {
116143 # Disable output and stream the file
117 - $this->getContext()->getOutput()->disable();
 144+ $this->getOutput()->disable();
118145 print 'Content-Type: ' . $file->getMimeType() . "\r\n";
119146 print 'Content-Length: ' . strlen( $req->getContent() ) . "\r\n";
120147 print "\r\n";

Status & tagging log