}
protected function openShowImage() {
- global $wgEnableUploads, $wgSend404Code;
+ global $wgEnableUploads, $wgSend404Code, $wgSVGMaxSize;
$this->loadFile();
$out = $this->getContext()->getOutput();
);
$linktext = $this->getContext()->msg( 'show-big-image' )->escaped();
- $thumbSizes = $this->getThumbSizes( $width, $height, $width_orig, $height_orig );
+ $thumbSizes = $this->getThumbSizes( $width_orig, $height_orig );
# Generate thumbnails or thumbnail links as needed...
$otherSizes = array();
foreach ( $thumbSizes as $size ) {
// the current thumbnail's size ($width/$height)
// since that is added to the message separately, so
// it can be denoted as the current size being shown.
- // Vectorized images are "infinitely" big, so all thumb
- // sizes are shown.
+ // Vectorized images are limited by $wgSVGMaxSize big,
+ // so all thumbs less than or equal that are shown.
if ( ( ( $size[0] <= $width_orig && $size[1] <= $height_orig )
- || $this->displayImg->isVectorized() )
+ || ( $this->displayImg->isVectorized()
+ && max( $size[0], $size[1] ) <= $wgSVGMaxSize )
+ )
&& $size[0] != $width && $size[1] != $height
) {
$sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] );
$longDesc = $this->getContext()->msg( 'parentheses', $this->displayImg->getLongDesc() )->text();
+ $handler = $this->displayImg->getHandler();
+
+ // If this is a filetype with potential issues, warn the user.
+ if ( $handler ) {
+ $warningConfig = $handler->getWarningConfig( $this->displayImg );
+
+ if ( $warningConfig !== null ) {
+ // The warning will be displayed via CSS and JavaScript.
+ // We just need to tell the client side what message to use.
+ $output = $this->getContext()->getOutput();
+ $output->addJsConfigVars( 'wgFileWarning', $warningConfig );
+ $output->addModules( $warningConfig['module'] );
+ $output->addModules( 'mediawiki.filewarning' );
+ }
+ }
+
$medialink = "[[Media:$filename|$linktext]]";
if ( !$this->displayImg->isSafeFile() ) {
$out->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
if ( !$this->getID() && $wgSend404Code ) {
// If there is no image, no shared image, and no description page,
- // output a 404, to be consistent with articles.
- $request->response()->header( 'HTTP/1.1 404 Not Found' );
+ // output a 404, to be consistent with Article::showMissingArticle.
+ $request->response()->statusHeader( 404 );
}
}
$out->setFileVersion( $this->displayImg );
$s = '';
$this->doQuery();
if ( count( $this->mHist ) ) {
+ if ( $this->mImg->isLocal() ) {
+ // Do a batch existence check for user pages and talkpages
+ $linkBatch = new LinkBatch();
+ for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) {
+ $file = $this->mHist[$i];
+ $user = $file->getUser( 'text' );
+ $linkBatch->add( NS_USER, $user );
+ $linkBatch->add( NS_USER_TALK, $user );
+ }
+ $linkBatch->execute();
+ }
+
$list = new ImageHistoryList( $this->mImagePage );
# Generate prev/next links
$navLink = $this->getNavigationBar();