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 ) {
27 $ser = $image->getMetadata()
29 $metadata = unserialize($ser);
30 return $width * $height * $metadata['frameCount'];
32 return $width * $height;
36 function getMetadataType( $image ) {
40 function getLongDesc( $image ) {
41 global $wgUser, $wgLang;
42 $sk = $wgUser->getSkin();
44 $metadata = @unserialize
($image->getMetadata());
46 if (!$metadata) return parent
::getLongDesc( $image );
49 $info[] = $image->getMimeType();
50 $info[] = $sk->formatSize( $image->getSize() );
52 if ($metadata['looped'])
53 $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
55 if ($metadata['frameCount'] > 1)
56 $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] );
58 if ($metadata['duration'])
59 $info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
61 $infoString = $wgLang->commaList( $info );
63 return "($infoString)";