summaryrefslogtreecommitdiff
path: root/includes/media/GIF.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/media/GIF.php')
-rw-r--r--includes/media/GIF.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/includes/media/GIF.php b/includes/media/GIF.php
index 3bfa45a1..32618e94 100644
--- a/includes/media/GIF.php
+++ b/includes/media/GIF.php
@@ -14,7 +14,7 @@
class GIFHandler extends BitmapHandler {
const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata.
-
+
function getMetadata( $image, $filename ) {
try {
$parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename );
@@ -50,17 +50,16 @@ class GIFHandler extends BitmapHandler {
/**
* @param $image File
- * @param $width
- * @param $height
- * @return
+ * @todo unittests
+ * @return bool
*/
- function getImageArea( $image, $width, $height ) {
+ function getImageArea( $image ) {
$ser = $image->getMetadata();
if ( $ser ) {
$metadata = unserialize( $ser );
- return $width * $height * $metadata['frameCount'];
+ return $image->getWidth() * $image->getHeight() * $metadata['frameCount'];
} else {
- return $width * $height;
+ return $image->getWidth() * $image->getHeight();
}
}
@@ -118,7 +117,7 @@ class GIFHandler extends BitmapHandler {
wfSuppressWarnings();
$metadata = unserialize($image->getMetadata());
wfRestoreWarnings();
-
+
if (!$metadata || $metadata['frameCount'] <= 1) {
return $original;
}
@@ -126,19 +125,19 @@ class GIFHandler extends BitmapHandler {
/* Preserve original image info string, but strip the last char ')' so we can add even more */
$info = array();
$info[] = $original;
-
+
if ( $metadata['looped'] ) {
$info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
}
-
+
if ( $metadata['frameCount'] > 1 ) {
$info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] );
}
-
+
if ( $metadata['duration'] ) {
$info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
}
-
+
return $wgLang->commaList( $info );
}
}