* (bug 36524) "Show" options on Special:RecentChanges and Special:RecentChangesLinked
are now remembered between successive clicks.
* (bug 26069) Page title is no longer "Error" for all error pages
+* (bug 39297) Show warning if thumbnail of animated image will not be animated.
=== API changes in 1.20 ===
* (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
}
}
+ // Add cannot animate thumbnail warning
+ if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) {
+ // Include the extension so wiki admins can
+ // customize it on a per file-type basis
+ // (aka say things like use format X instead).
+ // additionally have a specific message for
+ // file-no-thumb-animation-gif
+ $ext = $this->displayImg->getExtension();
+ $noAnimMesg = wfMessageFallback(
+ 'file-no-thumb-animation-' . $ext,
+ 'file-no-thumb-animation'
+ )->plain();
+
+ $out->addWikiText( <<<EOT
+<div class="mw-noanimatethumb">{$noAnimMesg}</div>
+EOT
+ );
+ }
+
if ( !$this->displayImg->isLocal() ) {
$this->printSharedImageText();
}
}
}
+ /**
+ * Will the thumbnail be animated if one would expect it to be.
+ *
+ * Currently used to add a warning to the image description page
+ *
+ * @return bool false if the main image is both animated
+ * and the thumbnail is not. In all other cases must return
+ * true. If image is not renderable whatsoever, should
+ * return true.
+ */
+ public function canAnimateThumbIfAppropriate() {
+ $handler = $this->getHandler();
+ if ( !$handler ) {
+ // We cannot handle image whatsoever, thus
+ // one would not expect it to be animated
+ // so true.
+ return true;
+ } else {
+ if ( $this->allowInlineDisplay()
+ && $handler->isAnimatedImage( $this )
+ && !$handler->canAnimateThumbnail( $this )
+ ) {
+ // Image is animated, but thumbnail isn't.
+ // This is unexpected to the user.
+ return false;
+ } else {
+ // Image is not animated, so one would
+ // not expect thumb to be
+ return true;
+ }
+ }
+ }
+
/**
* Get handler-specific metadata
* Overridden by LocalFile, UnregisteredLocalFile
return false;
}
+ /**
+ * We cannot animate thumbnails that are bigger than a particular size
+ * @param File $file
+ * @return bool
+ */
+ function canAnimateThumbnail( $file ) {
+ global $wgMaxAnimatedGifArea;
+ $answer = $this->getImageArea( $file ) <= $wgMaxAnimatedGifArea;
+ return $answer;
+ }
+
function getMetadataType( $image ) {
return 'parsed-gif';
}
return $gis;
}
- function isAnimatedImage( $image ) {
- return false;
- }
-
/**
* @param $file File
* @return string
* @return bool
*/
function isVectorized( $file ) { return false; }
+ /**
+ * The material is an image, and is animated.
+ * In particular, video material need not return true.
+ * @note Before 1.20, this was a method of ImageHandler only
+ * @return bool
+ */
+ function isAnimatedImage( $file ) { return false; }
+ /**
+ * If the material is animated, we can animate the thumbnail
+ * @since 1.20
+ * @return bool If material is not animated, handler may return any value.
+ */
+ function canAnimateThumbnail( $file ) { return true; }
/**
* False if the handler is disabled for all files
* @return bool
}
return false;
}
+ /**
+ * We do not support making APNG thumbnails, so always false
+ * @param $image File
+ * @return bool false
+ */
+ function canAnimateThumbnail( $image ) {
+ return false;
+ }
function getMetadataType( $image ) {
return 'parsed-png';
return false;
}
+ /**
+ * We do not support making animated svg thumbnails
+ */
+ function canAnimateThumb( $file ) {
+ return false;
+ }
+
/**
* @param $image File
* @param $params
'file-info-png-looped' => 'looped',
'file-info-png-repeat' => 'played $1 {{PLURAL:$1|time|times}}',
'file-info-png-frames' => '$1 {{PLURAL:$1|frame|frames}}',
+'file-no-thumb-animation'=> '\'\'\'Note: Due to technical limitations, thumbnails of this file will not be animated.\'\'\'',
+'file-no-thumb-animation-gif' => '\'\'\'Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated.\'\'\'',
# Special:NewFiles
'newimages' => 'Gallery of new files',
The variable $1 is the number of individual frames in an animated gif file.
For example of message in use see [[:File:Mouse10.gif]].',
+'file-no-thumb-animation' => 'We cannot animate thumbnails of this file. This notice is shown on the image description page on animated svg files just below {{msg-mw|file-info-size}}. This message may be overridden by a more specific message of the form file-no-thumb-animation-<extension> like {{msg-mw|file-no-thumb-animation-gif}}',
+'file-no-thumb-animation-gif' => 'Cannot animate thumbnails of this gif file, because it has to big a resolution. The cut off resolution can vary between wikis ([[mw:manual:$wgMaxAnimatedGifArea|$wgMaxAnimatedGifArea]]). Note that resolution is calculated as width times height times number of frames. See {{msg-mw|file-no-thumb-animation}}.',
# Special:NewFiles
'newimages' => 'Page title of [[Special:NewImages]].',
'file-info-png-looped',
'file-info-png-repeat',
'file-info-png-frames',
+ 'file-no-thumb-animation',
+ 'file-no-thumb-animation-gif',
),
'newfiles' => array(
'newimages',