summaryrefslogtreecommitdiff
path: root/includes/media/GIF.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes/media/GIF.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'includes/media/GIF.php')
-rw-r--r--includes/media/GIF.php43
1 files changed, 31 insertions, 12 deletions
diff --git a/includes/media/GIF.php b/includes/media/GIF.php
index dbe5f813..c4ede331 100644
--- a/includes/media/GIF.php
+++ b/includes/media/GIF.php
@@ -1,5 +1,7 @@
<?php
/**
+ * Handler for GIF images.
+ *
* @file
* @ingroup Media
*/
@@ -12,7 +14,7 @@
class GIFHandler extends BitmapHandler {
function getMetadata( $image, $filename ) {
- if ( !isset($image->parsedGIFMetadata) ) {
+ if ( !isset( $image->parsedGIFMetadata ) ) {
try {
$image->parsedGIFMetadata = GIFMetadataExtractor::getMetadata( $filename );
} catch( Exception $e ) {
@@ -22,7 +24,7 @@ class GIFHandler extends BitmapHandler {
}
}
- return serialize($image->parsedGIFMetadata);
+ return serialize( $image->parsedGIFMetadata );
}
@@ -39,22 +41,41 @@ class GIFHandler extends BitmapHandler {
return $width * $height;
}
}
+
+ function isAnimatedImage( $image ) {
+ $ser = $image->getMetadata();
+ if ($ser) {
+ $metadata = unserialize($ser);
+ if( $metadata['frameCount'] > 1 ) return true;
+ }
+ return false;
+ }
function getMetadataType( $image ) {
return 'parsed-gif';
}
+ function isMetadataValid( $image, $metadata ) {
+ wfSuppressWarnings();
+ $data = unserialize( $metadata );
+ wfRestoreWarnings();
+ return (boolean) $data;
+ }
+
function getLongDesc( $image ) {
- global $wgUser, $wgLang;
- $sk = $wgUser->getSkin();
-
- $metadata = @unserialize($image->getMetadata());
+ global $wgLang;
+
+ $original = parent::getLongDesc( $image );
+
+ wfSuppressWarnings();
+ $metadata = unserialize($image->getMetadata());
+ wfRestoreWarnings();
- if (!$metadata) return parent::getLongDesc( $image );
+ if (!$metadata || $metadata['frameCount'] <= 1)
+ return $original;
$info = array();
- $info[] = $image->getMimeType();
- $info[] = $sk->formatSize( $image->getSize() );
+ $info[] = $original;
if ($metadata['looped'])
$info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
@@ -65,8 +86,6 @@ class GIFHandler extends BitmapHandler {
if ($metadata['duration'])
$info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
- $infoString = $wgLang->commaList( $info );
-
- return "($infoString)";
+ return $wgLang->commaList( $info );
}
}