}
/**
- * From parameters, construct a 'scale' array
- * @param $params Array:
+ * From parameters, construct a 'scale' array
+ * @param $params Array:
* @return Array or Null: key-val array of 'width' and 'height', or null
- */
+ */
public function getScale( $params ) {
$p = $this->getModulePrefix();
if ( $params['urlheight'] != -1 && $params['urlwidth'] == -1 ) {
$vals['size'] = intval( $file->getSize() );
$vals['width'] = intval( $file->getWidth() );
$vals['height'] = intval( $file->getHeight() );
-
+
$pageCount = $file->pageCount();
if ( $pageCount !== false ) {
$vals['pagecount'] = $pageCount;
}
if ( isset( $prop['parsedcomment'] ) ) {
global $wgUser;
- $vals['parsedcomment'] = $wgUser->getSkin()->formatComment(
+ $vals['parsedcomment'] = $wgUser->getSkin()->formatComment(
$file->getDescription(), $file->getTitle() );
}
-
+
if ( isset( $prop['sha1'] ) ) {
$vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 );
}
/**
- * Return the API documentation for the parameters.
+ * Return the API documentation for the parameters.
* @return {Array} parameter documentation.
*/
public function getParamDescription() {
' dimensions - Alias for size',
' sha1 - Adds SHA-1 hash for the image',
' mime - Adds MIME type of the image',
- ' thumbmime - Adss MIME type of the image thumbnail (requires url)',
+ ' thumbmime - Adds MIME type of the image thumbnail (requires url)',
' metadata - Lists EXIF metadata for the version of the image',
' archivename - Adds the file name of the archive version for non-latest versions',
' bitdepth - Adds the bit depth of the version',
$prop = array_flip( $params['prop'] );
$scale = $this->getScale( $params );
-
+
$result = $this->getResult();
-
+
try {
$stash = new UploadStash();
-
- foreach ( $params['sessionkey'] as $sessionkey ) {
+
+ foreach ( $params['sessionkey'] as $sessionkey ) {
$file = $stash->getFile( $sessionkey );
$imageInfo = self::getInfo( $file, $prop, $result, $scale );
$result->addValue( array( 'query', $this->getModuleName() ), null, $imageInfo );
$this->dieUsage( "File not found: " . $e->getMessage(), "invalidsessiondata" );
} catch ( UploadStashBadPathException $e ) {
$this->dieUsage( "Bad path: " . $e->getMessage(), "invalidsessiondata" );
- }
-
+ }
}
/**
public function getAllowedParams() {
return array(
- 'sessionkey' => array(
+ 'sessionkey' => array(
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_REQUIRED => true,
ApiBase::PARAM_DFLT => null
' dimensions - Alias for size',
' sha1 - Adds sha1 hash for the image',
' mime - Adds MIME of the image',
- ' thumbmime - Adss MIME of the image thumbnail (requires url)',
+ ' thumbmime - Adds MIME of the image thumbnail (requires url)',
' metadata - Lists EXIF metadata for the version of the image',
' bitdepth - Adds the bit depth of the version',
),