Merge "prop=imageinfo&iiprop=url|thumbmime needs iiurlwidth="

This commit is contained in:
Catrope 2012-07-18 01:42:33 +00:00 committed by Gerrit Code Review
commit 2217f124da
3 changed files with 8 additions and 7 deletions

View file

@ -240,7 +240,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
);
}
private $propertyFilter = array( 'archivename' );
private $propertyFilter = array( 'archivename', 'thumbmime' );
public function getResultProperties() {
return array_merge(

View file

@ -490,7 +490,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
*
* @return array
*/
private static function getProperties() {
private static function getProperties( $modulePrefix = '' ) {
return array(
'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
'user' => ' user - Adds the user who uploaded the image version',
@ -502,7 +502,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
'dimensions' => ' dimensions - Alias for size', // For backwards compatibility with Allimages
'sha1' => ' sha1 - Adds SHA-1 hash for the image',
'mime' => ' mime - Adds MIME type of the image',
'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail (requires url)',
'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
' (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',
'archivename' => ' archivename - Adds the file name of the archive version for non-latest versions',
@ -517,10 +518,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
*
* @return array
*/
public static function getPropertyDescriptions( $filter = array() ) {
public static function getPropertyDescriptions( $filter = array(), $modulePrefix = '' ) {
return array_merge(
array( 'What image information to get:' ),
array_values( array_diff_key( self::getProperties(), array_flip( $filter ) ) )
array_values( array_diff_key( self::getProperties( $modulePrefix ), array_flip( $filter ) ) )
);
}
@ -531,7 +532,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
public function getParamDescription() {
$p = $this->getModulePrefix();
return array(
'prop' => self::getPropertyDescriptions(),
'prop' => self::getPropertyDescriptions( array(), $p ),
'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
'Only the current version of the image can be scaled' ),
'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth",

View file

@ -113,7 +113,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
public function getParamDescription() {
$p = $this->getModulePrefix();
return array(
'prop' => self::getPropertyDescriptions( $this->propertyFilter ),
'prop' => self::getPropertyDescriptions( $this->propertyFilter, $p ),
'filekey' => 'Key that identifies a previous upload that was stashed temporarily.',
'sessionkey' => 'Alias for filekey, for backward compatibility.',
'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",