35 }
catch ( Exception $e ) {
37 wfDebug( __METHOD__ .
': ' . $e->getMessage() .
"\n" );
52 if ( count( $meta ) === 0 ) {
71 if ( !isset( $meta[
'metadata'] ) ) {
74 unset( $meta[
'metadata'][
'_MW_GIF_VERSION'] );
76 return $meta[
'metadata'];
86 $ser = $image->getMetadata();
89 if ( isset( $metadata[
'frameCount'] ) && $metadata[
'frameCount'] > 0 ) {
90 return $image->getWidth() * $image->getHeight() * $metadata[
'frameCount'];
92 return $image->getWidth() * $image->getHeight();
95 return $image->getWidth() * $image->getHeight();
104 $ser = $image->getMetadata();
107 if ( isset( $metadata[
'frameCount'] ) && $metadata[
'frameCount'] > 1 ) {
132 if ( $metadata === self::BROKEN_FILE ) {
137 Wikimedia\suppressWarnings();
139 Wikimedia\restoreWarnings();
141 if ( !$data || !is_array( $data ) ) {
142 wfDebug( __METHOD__ .
" invalid GIF metadata\n" );
147 if ( !isset( $data[
'metadata'][
'_MW_GIF_VERSION'] )
150 wfDebug( __METHOD__ .
" old but compatible GIF metadata\n" );
165 $original = parent::getLongDesc( $image );
167 Wikimedia\suppressWarnings();
169 Wikimedia\restoreWarnings();
171 if ( !$metadata || $metadata[
'frameCount'] <= 1 ) {
179 if ( $metadata[
'looped'] ) {
180 $info[] =
wfMessage(
'file-info-gif-looped' )->parse();
183 if ( $metadata[
'frameCount'] > 1 ) {
184 $info[] =
wfMessage(
'file-info-gif-frames' )->numParams( $metadata[
'frameCount'] )->parse();
187 if ( $metadata[
'duration'] ) {
188 $info[] =
$wgLang->formatTimePeriod( $metadata[
'duration'] );
191 return $wgLang->commaList( $info );
203 $serMeta =
$file->getMetadata();
204 Wikimedia\suppressWarnings();
206 Wikimedia\restoreWarnings();
208 if ( !$metadata || !isset( $metadata[
'duration'] ) || !$metadata[
'duration'] ) {
211 return (
float)$metadata[
'duration'];
unserialize( $serialized)
$wgMaxAnimatedGifArea
Force thumbnailing of animated GIFs above this size to a single frame instead of an animated thumbnai...
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Generic handler for bitmap images.
Implements some public methods and some protected utility functions which are required by multiple ch...
getMetadata()
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
isMetadataValid( $image, $metadata)
Check if the metadata string is valid for this handler.
getLength( $file)
Return the duration of the GIF file.
getMetadata( $image, $filename)
Get handler-specific metadata which will be saved in the img_metadata field.
canAnimateThumbnail( $file)
We cannot animate thumbnails that are bigger than a particular size.
formatMetadata( $image, $context=false)
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
getCommonMetaArray(File $image)
Return the standard metadata elements for #filemetadata parser func.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.