8 * Handler for GIF images.
12 class GIFHandler
extends BitmapHandler
{
14 function getMetadata( $image, $filename ) {
15 if ( !isset($image->parsedGIFMetadata
) ) {
17 $image->parsedGIFMetadata
= GIFMetadataExtractor
::getMetadata( $filename );
18 } catch( Exception
$e ) {
20 wfDebug( __METHOD__
. ': ' . $e->getMessage() . "\n" );
25 return serialize($image->parsedGIFMetadata
);
29 function formatMetadata( $image ) {
33 function getImageArea( $image, $width, $height ) {
34 $ser = $image->getMetadata();
36 $metadata = unserialize($ser);
37 return $width * $height * $metadata['frameCount'];
39 return $width * $height;
43 function getMetadataType( $image ) {
47 function getLongDesc( $image ) {
48 global $wgUser, $wgLang;
49 $sk = $wgUser->getSkin();
51 $metadata = @unserialize
($image->getMetadata());
53 if (!$metadata) return parent
::getLongDesc( $image );
56 $info[] = $image->getMimeType();
57 $info[] = $sk->formatSize( $image->getSize() );
59 if ($metadata['looped'])
60 $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
62 if ($metadata['frameCount'] > 1)
63 $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] );
65 if ($metadata['duration'])
66 $info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
68 $infoString = $wgLang->commaList( $info );
70 return "($infoString)";