X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FGIF.php;h=19635dacbd9f9f1c3c20b65c69346dfb5bdd8092;hb=657a337d5b4c2f0654fd3927b1799ae0478dbd15;hp=608fb257f2d0e1e8ad5ec867b6ab0ec8ca0e3103;hpb=ebbea3c974312c56e93799fc93ee3f35130703f9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/GIF.php b/includes/media/GIF.php index 608fb257f2..19635dacbd 100644 --- a/includes/media/GIF.php +++ b/includes/media/GIF.php @@ -47,20 +47,31 @@ class GIFHandler extends BitmapHandler { * @return array|bool */ function formatMetadata( $image ) { + $meta = $this->getCommonMetaArray( $image ); + if ( count( $meta ) === 0 ) { + return false; + } + + return $this->formatMetadataHelper( $meta ); + } + + /** + * Return the standard metadata elements for #filemetadata parser func. + * @param File $image + * @return array|bool + */ + public function getCommonMetaArray( File $image ) { $meta = $image->getMetadata(); if ( !$meta ) { - return false; + return array(); } $meta = unserialize( $meta ); - if ( !isset( $meta['metadata'] ) || count( $meta['metadata'] ) <= 1 ) { - return false; - } - - if ( isset( $meta['metadata']['_MW_GIF_VERSION'] ) ) { - unset( $meta['metadata']['_MW_GIF_VERSION'] ); + if ( !isset( $meta['metadata'] ) ) { + return array(); } - return $this->formatMetadataHelper( $meta['metadata'] ); + unset( $meta['metadata']['_MW_GIF_VERSION'] ); + return $meta['metadata']; } /**