*/
static function newFromTitle( Title $title, $repo ) {
$data = $repo->fetchImageQuery( array(
- 'titles' => 'File:' . $title->getDBKey(),
- 'iiprop' => self::getProps(),
- 'prop' => 'imageinfo',
+ 'titles' => 'File:' . $title->getDBKey(),
+ 'iiprop' => self::getProps(),
+ 'prop' => 'imageinfo',
'iimetadataversion' => MediaHandler::getMetadataVersion()
) );
}
// Dummy functions...
+
+ /**
+ * @return bool
+ */
public function exists() {
return $this->mExists;
}
+ /**
+ * @return bool
+ */
public function getPath() {
return false;
}
+ /**
+ * @param Array $params
+ * @param int $flags
+ * @return bool|MediaTransformOutput
+ */
function transform( $params, $flags = 0 ) {
if( !$this->canRender() ) {
// show icon
}
// Info we can get from API...
+
+ /**
+ * @param $page int
+ * @return int|number
+ */
public function getWidth( $page = 1 ) {
return isset( $this->mInfo['width'] ) ? intval( $this->mInfo['width'] ) : 0;
}
return isset( $this->mInfo['height'] ) ? intval( $this->mInfo['height'] ) : 0;
}
+ /**
+ * @return bool|null|string
+ */
public function getMetadata() {
if ( isset( $this->mInfo['metadata'] ) ) {
return serialize( self::parseMetadata( $this->mInfo['metadata'] ) );
return null;
}
+ /**
+ * @param $metadata array
+ * @return array
+ */
public static function parseMetadata( $metadata ) {
if( !is_array( $metadata ) ) {
return $metadata;
return $ret;
}
+ /**
+ * @return bool|int|null
+ */
public function getSize() {
return isset( $this->mInfo['size'] ) ? intval( $this->mInfo['size'] ) : null;
}
+ /**
+ * @return null|string
+ */
public function getUrl() {
return isset( $this->mInfo['url'] ) ? strval( $this->mInfo['url'] ) : null;
}
+ /**
+ * @param string $method
+ * @return int|null|string
+ */
public function getUser( $method='text' ) {
return isset( $this->mInfo['user'] ) ? strval( $this->mInfo['user'] ) : null;
}
- public function getDescription() {
+ /**
+ * @return null|string
+ */
+ public function getDescription( $audience = self::FOR_PUBLIC, User $user = null ) {
return isset( $this->mInfo['comment'] ) ? strval( $this->mInfo['comment'] ) : null;
}
+ /**
+ * @return null|String
+ */
function getSha1() {
return isset( $this->mInfo['sha1'] )
? wfBaseConvert( strval( $this->mInfo['sha1'] ), 16, 36, 31 )
: null;
}
+ /**
+ * @return bool|Mixed|string
+ */
function getTimestamp() {
return wfTimestamp( TS_MW,
isset( $this->mInfo['timestamp'] )
);
}
+ /**
+ * @return string
+ */
function getMimeType() {
if( !isset( $this->mInfo['mime'] ) ) {
$magic = MimeMagic::singleton();
return $this->mInfo['mime'];
}
- /// @todo FIXME: May guess wrong on file types that can be eg audio or video
+ /**
+ * @todo FIXME: May guess wrong on file types that can be eg audio or video
+ * @return int|string
+ */
function getMediaType() {
$magic = MimeMagic::singleton();
return $magic->getMediaType( null, $this->getMimeType() );
}
+ /**
+ * @return bool|string
+ */
function getDescriptionUrl() {
return isset( $this->mInfo['descriptionurl'] )
? $this->mInfo['descriptionurl']
/**
* Only useful if we're locally caching thumbs anyway...
+ * @param $suffix string
* @return null|string
*/
function getThumbPath( $suffix = '' ) {
}
}
+ /**
+ * @return array
+ */
function getThumbnails() {
$dir = $this->getThumbPath( $this->getName() );
$iter = $this->repo->getBackend()->getFileList( array( 'dir' => $dir ) );
$wgMemc->delete( $key );
}
+ /**
+ * @param $options array
+ */
function purgeThumbnails( $options = array() ) {
global $wgMemc;