API: Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Thu, 31 Jul 2008 20:10:36 +0000 (20:10 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Thu, 31 Jul 2008 20:10:36 +0000 (20:10 +0000)
CREDITS
RELEASE-NOTES
includes/api/ApiQueryAllimages.php
includes/api/ApiQueryImageInfo.php
includes/filerepo/File.php
includes/filerepo/LocalFile.php

diff --git a/CREDITS b/CREDITS
index 990f331..96fb428 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -6,6 +6,7 @@ following names for their contribution to the product.
 * Alexandre Emsenhuber
 * Aryeh Gregor
 * Brion Vibber
+* Bryan Tong Minh
 * Chad Horohoe
 * Greg Sabino Mullane
 * Hojjat
index 139bfce..90a4083 100644 (file)
@@ -56,6 +56,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   or other engine which doesn't support a separate title search function.
   This means you can use API search on Wikipedia without explicitly adding
   &srwhat=text to the query.
+* Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages
 
 
 === Languages updated in 1.14 ===
index f8abaaf..89a89e7 100644 (file)
@@ -162,7 +162,8 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                                        'dimensions', // Obsolete
                                        'mime',
                                        'sha1',
-                                       'metadata'
+                                       'metadata',
+                                       'bitdepth',
                                ),
                                ApiBase :: PARAM_DFLT => 'timestamp|url',
                                ApiBase :: PARAM_ISMULTI => true
index d28792a..99201e2 100644 (file)
@@ -148,6 +148,9 @@ class ApiQueryImageInfo extends ApiQueryBase {
                
                if( isset( $prop['archivename'] ) && $file->isOld() )
                        $vals['archivename'] = $file->getArchiveName();
+                       
+               if( isset( $prop['bitdepth'] ) )
+                       $vals['bitdepth'] = $file->getBitDepth();
 
                return $vals;
        }
@@ -166,7 +169,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        'sha1',
                                        'mime',
                                        'metadata',
-                                       'archivename'
+                                       'archivename',
+                                       'bitdepth',
                                )
                        ),
                        'limit' => array(
index 64b48e0..5b9a71e 100644 (file)
@@ -264,7 +264,14 @@ abstract class File {
         * Overridden by LocalFile, UnregisteredLocalFile
         * STUB
         */
-       function getMetadata() { return false; }
+       public function getMetadata() { return false; }
+
+       /**
+        * Return the bit depth of the file
+        * Overridden by LocalFile
+        * STUB
+        */
+       public function getBitDepth() { return 0; }
 
        /**
         * Return the size of the image file, in bytes
index 7ed9ce0..1964156 100644 (file)
@@ -453,6 +453,11 @@ class LocalFile extends File
                return $this->metadata;
        }
 
+       function getBitDepth() {
+               $this->load();
+               return $this->bits;
+       }
+
        /**
         * Return the size of the image file, in bytes
         * @public