Uploads that throw a warning (UploadFromStash) a thumbnail is now shown.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Tue, 25 Jan 2011 20:59:32 +0000 (20:59 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Tue, 25 Jan 2011 20:59:32 +0000 (20:59 +0000)
RELEASE-NOTES
includes/specials/SpecialUpload.php

index 8e1337a..d571625 100644 (file)
@@ -52,6 +52,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Alternative to $wgHooks implemented, using the new Hooks class. 
 * Add width parameter to Special:Filepath to allow getting the file path of a thumbnail.
 * (bug 26870) Add size to {{filepath:}}
+* Upload warnings now show a thumbnail of the uploaded file
 
 === Bug fixes in 1.18 ===
 * (bug 23119) WikiError class and subclasses are now marked as deprecated
index 008ba16..f239edf 100644 (file)
@@ -938,6 +938,26 @@ class UploadForm extends HTMLForm {
        protected function getDescriptionSection() {
                global $wgUser;
 
+               if ( $this->mSessionKey ) {
+                       $stash = new UploadStash;
+                       try {
+                               $file = $stash->getFile( $this->mSessionKey );
+                       } catch ( MWException $e ) {
+                               $file = null;   
+                       }
+                       if ( $file ) {
+                               global $wgContLang;
+                               
+                               $mto = $file->transform( array( 'width' => 120 ) );
+                               $this->addHeaderText( 
+                                       '<div class="thumb t' . $wgContLang->alignEnd() . '">' .
+                                       Html::element( 'img', array( 
+                                               'src' => $mto->getUrl(),
+                                               'class' => 'thumbimage',
+                                       ) ) . '</div>', 'description' );
+                       }
+               }
+               
                $descriptor = array(
                        'DestFile' => array(
                                'type' => 'text',