$prop = array_flip( $params['prop'] );
$scale = $this->getScale( $params );
-
+
$result = $this->getResult();
-
+
try {
- $stash = new UploadStash();
-
- foreach ( $params['sessionkey'] as $sessionkey ) {
+ $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
+
+ foreach ( $params['sessionkey'] as $sessionkey ) {
$file = $stash->getFile( $sessionkey );
- $imageInfo = self::getInfo( $file, $prop, $result, $scale );
+ $finalThumbParam = $this->mergeThumbParams( $file, $scale, $params['urlparam'] );
+ $imageInfo = self::getInfo( $file, $prop, $result, $finalThumbParam );
$result->addValue( array( 'query', $this->getModuleName() ), null, $imageInfo );
$result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $modulePrefix );
}
$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
'urlheight' => array(
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_DFLT => -1
- )
+ ),
+ 'urlparam' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_DFLT => '',
+ ),
);
}
' 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',
),
'sessionkey' => 'Session key that identifies a previous upload that was stashed temporarily.',
'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
- 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth"
+ 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth",
+ 'urlparam' => array( "A handler specific parameter string. For example, pdf's ",
+ "might use 'page15-100px'. {$p}urlwidth must be used and be consistent with {$p}urlparam" ),
);
}