40 }
catch ( Exception $e ) {
42 wfDebug( __METHOD__ .
': ' . $e->getMessage() .
"\n" );
57 if ( count( $meta ) === 0 ) {
77 if ( !isset( $meta[
'metadata'] ) ) {
80 unset( $meta[
'metadata'][
'_MW_PNG_VERSION'] );
82 return $meta[
'metadata'];
90 $ser = $image->getMetadata();
93 if ( $metadata[
'frameCount'] > 1 ) {
115 if ( $metadata === self::BROKEN_FILE ) {
120 Wikimedia\suppressWarnings();
122 Wikimedia\restoreWarnings();
124 if ( !$data || !is_array( $data ) ) {
125 wfDebug( __METHOD__ .
" invalid png metadata\n" );
130 if ( !isset( $data[
'metadata'][
'_MW_PNG_VERSION'] )
133 wfDebug( __METHOD__ .
" old but compatible png metadata\n" );
147 $original = parent::getLongDesc( $image );
149 Wikimedia\suppressWarnings();
151 Wikimedia\restoreWarnings();
153 if ( !$metadata || $metadata[
'frameCount'] <= 0 ) {
160 if ( $metadata[
'loopCount'] == 0 ) {
161 $info[] =
wfMessage(
'file-info-png-looped' )->parse();
162 } elseif ( $metadata[
'loopCount'] > 1 ) {
163 $info[] =
wfMessage(
'file-info-png-repeat' )->numParams( $metadata[
'loopCount'] )->parse();
166 if ( $metadata[
'frameCount'] > 0 ) {
167 $info[] =
wfMessage(
'file-info-png-frames' )->numParams( $metadata[
'frameCount'] )->parse();
170 if ( $metadata[
'duration'] ) {
171 $info[] =
$wgLang->formatTimePeriod( $metadata[
'duration'] );
174 return $wgLang->commaList( $info );
186 $serMeta =
$file->getMetadata();
187 Wikimedia\suppressWarnings();
189 Wikimedia\restoreWarnings();
191 if ( !$metadata || !isset( $metadata[
'duration'] ) || !$metadata[
'duration'] ) {
194 return (
float)$metadata[
'duration'];
unserialize( $serialized)
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.
formatMetadata( $image, $context=false)
getCommonMetaArray(File $image)
Get a file type independent array of metadata.
supportsBucketing()
Returns whether or not this handler supports the chained generation of thumbnails according to bucket...
getLength( $file)
Return the duration of an APNG file.
getMetadata( $image, $filename)
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
canAnimateThumbnail( $image)
We do not support making APNG thumbnails, so always false.
isMetadataValid( $image, $metadata)
Check if the metadata string is valid for this handler.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.