From 41e923e164e2fa3241de8646de32173b4c881c5f Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Tue, 25 Jan 2011 20:59:32 +0000 Subject: [PATCH] Uploads that throw a warning (UploadFromStash) a thumbnail is now shown. --- RELEASE-NOTES | 1 + includes/specials/SpecialUpload.php | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8e1337acab..d5716251ae 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 008ba16901..f239edff18 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -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( + '
' . + Html::element( 'img', array( + 'src' => $mto->getUrl(), + 'class' => 'thumbimage', + ) ) . '
', 'description' ); + } + } + $descriptor = array( 'DestFile' => array( 'type' => 'text', -- 2.20.1