diff options
Diffstat (limited to 'includes/api/ApiQueryImageInfo.php')
-rw-r--r-- | includes/api/ApiQueryImageInfo.php | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 33ff1d3f..612d5cc9 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -56,10 +56,10 @@ class ApiQueryImageInfo extends ApiQueryBase { } $pageIds = $this->getPageSet()->getAllTitlesByNamespace(); - if (!empty($pageIds[NS_IMAGE])) { + if (!empty($pageIds[NS_FILE])) { $result = $this->getResult(); - $images = RepoGroup::singleton()->findFiles( array_keys( $pageIds[NS_IMAGE] ) ); + $images = RepoGroup::singleton()->findFiles( array_keys( $pageIds[NS_FILE] ) ); foreach ( $images as $img ) { $data = array(); @@ -78,14 +78,14 @@ class ApiQueryImageInfo extends ApiQueryBase { if(++$count > $params['limit']) { // We've reached the extra one which shows that there are additional pages to be had. Stop here... // Only set a query-continue if there was only one title - if(count($pageIds[NS_IMAGE]) == 1) + if(count($pageIds[NS_FILE]) == 1) $this->setContinueEnumParameter('start', $oldie->getTimestamp()); break; } $data[] = self::getInfo( $oldie, $prop, $result ); } - $pageId = $pageIds[NS_IMAGE][ $img->getOriginalTitle()->getDBkey() ]; + $pageId = $pageIds[NS_FILE][ $img->getOriginalTitle()->getDBkey() ]; $result->addValue( array( 'query', 'pages', intval( $pageId ) ), 'imagerepository', $img->getRepoName() @@ -93,10 +93,10 @@ class ApiQueryImageInfo extends ApiQueryBase { $this->addPageSubItems($pageId, $data); } - $missing = array_diff( array_keys( $pageIds[NS_IMAGE] ), array_keys( $images ) ); + $missing = array_diff( array_keys( $pageIds[NS_FILE] ), array_keys( $images ) ); foreach ( $missing as $title ) $result->addValue( - array( 'query', 'pages', intval( $pageIds[NS_IMAGE][$title] ) ), + array( 'query', 'pages', intval( $pageIds[NS_FILE][$title] ) ), 'imagerepository', '' ); } @@ -123,12 +123,12 @@ class ApiQueryImageInfo extends ApiQueryBase { } if( isset( $prop['url'] ) ) { if( !is_null( $scale ) && !$file->isOld() ) { - $thumb = $file->getThumbnail( $scale['width'], $scale['height'] ); - if( $thumb ) + $mto = $file->transform( array( 'width' => $scale['width'], 'height' => $scale['height'] ) ); + if( $mto && !$mto->isError() ) { - $vals['thumburl'] = wfExpandUrl( $thumb->getURL() ); - $vals['thumbwidth'] = $thumb->getWidth(); - $vals['thumbheight'] = $thumb->getHeight(); + $vals['thumburl'] = $mto->getUrl(); + $vals['thumbwidth'] = $mto->getWidth(); + $vals['thumbheight'] = $mto->getHeight(); } } $vals['url'] = $file->getFullURL(); @@ -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( @@ -219,6 +223,6 @@ class ApiQueryImageInfo extends ApiQueryBase { } public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryImageInfo.php 37504 2008-07-10 14:28:09Z catrope $'; + return __CLASS__ . ': $Id: ApiQueryImageInfo.php 44121 2008-12-01 17:14:30Z vyznev $'; } } |