API: Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages

This commit is contained in:
Bryan Tong Minh 2008-07-31 20:10:36 +00:00
parent 1172eb1071
commit e2564980c3
6 changed files with 22 additions and 3 deletions

View file

@ -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

View 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 ===

View 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

View 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(

View 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

View 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