summaryrefslogtreecommitdiff
path: root/includes/media/PNG.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/media/PNG.php')
-rw-r--r--includes/media/PNG.php33
1 files changed, 18 insertions, 15 deletions
diff --git a/includes/media/PNG.php b/includes/media/PNG.php
index 1b329e57..98f13861 100644
--- a/includes/media/PNG.php
+++ b/includes/media/PNG.php
@@ -38,13 +38,13 @@ class PNGHandler extends BitmapHandler {
function getMetadata( $image, $filename ) {
try {
$metadata = BitmapMetadataHandler::PNG( $filename );
- } catch( Exception $e ) {
+ } catch ( Exception $e ) {
// Broken file?
wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
return self::BROKEN_FILE;
}
- return serialize($metadata);
+ return serialize( $metadata );
}
/**
@@ -74,9 +74,11 @@ class PNGHandler extends BitmapHandler {
*/
function isAnimatedImage( $image ) {
$ser = $image->getMetadata();
- if ($ser) {
- $metadata = unserialize($ser);
- if( $metadata['frameCount'] > 1 ) return true;
+ if ( $ser ) {
+ $metadata = unserialize( $ser );
+ if ( $metadata['frameCount'] > 1 ) {
+ return true;
+ }
}
return false;
}
@@ -88,11 +90,11 @@ class PNGHandler extends BitmapHandler {
function canAnimateThumbnail( $image ) {
return false;
}
-
+
function getMetadataType( $image ) {
return 'parsed-png';
}
-
+
function isMetadataValid( $image, $metadata ) {
if ( $metadata === self::BROKEN_FILE ) {
@@ -105,13 +107,13 @@ class PNGHandler extends BitmapHandler {
wfRestoreWarnings();
if ( !$data || !is_array( $data ) ) {
- wfDebug(__METHOD__ . ' invalid png metadata' );
+ wfDebug( __METHOD__ . " invalid png metadata\n" );
return self::METADATA_BAD;
}
if ( !isset( $data['metadata']['_MW_PNG_VERSION'] )
|| $data['metadata']['_MW_PNG_VERSION'] != PNGMetadataExtractor::VERSION ) {
- wfDebug(__METHOD__ . ' old but compatible png metadata' );
+ wfDebug( __METHOD__ . " old but compatible png metadata\n" );
return self::METADATA_COMPATIBLE;
}
return self::METADATA_GOOD;
@@ -126,29 +128,30 @@ class PNGHandler extends BitmapHandler {
$original = parent::getLongDesc( $image );
wfSuppressWarnings();
- $metadata = unserialize($image->getMetadata());
+ $metadata = unserialize( $image->getMetadata() );
wfRestoreWarnings();
- if( !$metadata || $metadata['frameCount'] <= 0 )
+ if ( !$metadata || $metadata['frameCount'] <= 0 ) {
return $original;
+ }
$info = array();
$info[] = $original;
-
+
if ( $metadata['loopCount'] == 0 ) {
$info[] = wfMessage( 'file-info-png-looped' )->parse();
} elseif ( $metadata['loopCount'] > 1 ) {
$info[] = wfMessage( 'file-info-png-repeat' )->numParams( $metadata['loopCount'] )->parse();
}
-
+
if ( $metadata['frameCount'] > 0 ) {
$info[] = wfMessage( 'file-info-png-frames' )->numParams( $metadata['frameCount'] )->parse();
}
-
+
if ( $metadata['duration'] ) {
$info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
}
-
+
return $wgLang->commaList( $info );
}