Follow-up I49b7d8a - Add api module for common metadata
authorBrian Wolff <bawolff+wn@gmail.com>
Mon, 12 Aug 2013 14:24:11 +0000 (11:24 -0300)
committerReedy <reedy@wikimedia.org>
Thu, 23 Jan 2014 22:06:19 +0000 (22:06 +0000)
Change-Id: I0d957891e0778ba0454f6fecb06524211506f6b9

includes/api/ApiQueryImageInfo.php

index cfc858a..baee9b1 100644 (file)
@@ -419,6 +419,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                $sha1 = isset( $prop['sha1'] );
                $meta = isset( $prop['metadata'] );
                $extmetadata = isset( $prop['extmetadata'] );
+               $commonmeta = isset( $prop['commonmetadata'] );
                $mime = isset( $prop['mime'] );
                $mediatype = isset( $prop['mediatype'] );
                $archive = isset( $prop['archivename'] );
@@ -490,6 +491,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        }
                        $vals['metadata'] = $metadata ? self::processMetaData( $metadata, $result ) : null;
                }
+               if ( $commonmeta ) {
+                       $metaArray = $file->getCommonMetaArray();
+                       $vals['commonmetadata'] = $metaArray ? self::processMetaData( $metaArray, $result ) : array();
+               }
 
                if ( $extmetadata ) {
                        // Note, this should return an array where all the keys
@@ -672,6 +677,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                ' (requires url and param ' . $modulePrefix . 'urlwidth)',
                        'mediatype' =>      ' mediatype     - Adds the media type of the image',
                        'metadata' =>       ' metadata      - Lists Exif metadata for the version of the image',
+                       'commonmetadata' => ' commonmetadata - Lists file format generic metadata for the version of the image',
                        'extmetadata' =>    ' extmetadata   - Lists formatted metadata combined ' .
                                'from multiple sources. Results are HTML formatted.',
                        'archivename' =>    ' archivename   - Adds the file name of the archive ' .