8 * Handler for GIF images.
12 class GIFHandler
extends BitmapHandler
{
14 function getMetadata( $image, $filename ) {
15 if ( !isset($image->parsedGIFMetadata
) )
16 $image->parsedGIFMetadata
= GIFMetadataExtractor
::getMetadata( $filename );
18 return serialize($image->parsedGIFMetadata
);
22 function formatMetadata( $image ) {
26 function getImageArea( $image, $width, $height ) {
28 $metadata = unserialize($image->getMetadata());
29 return $width * $height * $metadata['frameCount'];
31 return $width * $height;
35 function getMetadataType( $image ) {
39 function getLongDesc( $image ) {
40 global $wgUser, $wgLang;
41 $sk = $wgUser->getSkin();
43 $metadata = @unserialize
($image->getMetadata());
45 if (!$metadata) return parent
::getLongDesc( $image );
48 $info[] = $image->getMimeType();
49 $info[] = $sk->formatSize( $image->getSize() );
51 if ($metadata['looped'])
52 $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
54 if ($metadata['frameCount'] > 1)
55 $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] );
57 if ($metadata['duration'])
58 $info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
60 $infoString = $wgLang->commaList( $info );
62 return "($infoString)";