* @ingroup FileAbstraction
*/
class UnregisteredLocalFile extends File {
- var $title, $path, $mime, $dims;
+ var $title, $path, $mime, $dims, $metadata;
/**
* @var MediaHandler
/**
* Create an UnregisteredLocalFile based on a path or a (title,repo) pair.
* A FileRepo object is not required here, unlike most other File classes.
- *
+ *
* @throws MWException
* @param $title Title|bool
- * @param $repo FileRepo
- * @param $path string
- * @param $mime string
+ * @param $repo FileRepo|bool
+ * @param $path string|bool
+ * @param $mime string|bool
*/
function __construct( $title = false, $repo = false, $path = false, $mime = false ) {
if ( !( $title && $repo ) && !$path ) {
$this->dims = array();
}
+ /**
+ * @param $page int
+ * @return bool
+ */
private function cachePageDimensions( $page = 1 ) {
if ( !isset( $this->dims[$page] ) ) {
if ( !$this->getHandler() ) {
return $this->dims[$page];
}
+ /**
+ * @param $page int
+ * @return number
+ */
function getWidth( $page = 1 ) {
$dim = $this->cachePageDimensions( $page );
return $dim['width'];
}
+ /**
+ * @param $page int
+ * @return number
+ */
function getHeight( $page = 1 ) {
$dim = $this->cachePageDimensions( $page );
return $dim['height'];
}
+ /**
+ * @return bool|string
+ */
function getMimeType() {
if ( !isset( $this->mime ) ) {
$magic = MimeMagic::singleton();
return $this->mime;
}
+ /**
+ * @param $filename String
+ * @return Array|bool
+ */
function getImageSize( $filename ) {
if ( !$this->getHandler() ) {
return false;
return $this->handler->getImageSize( $this, $this->getLocalRefPath() );
}
+ /**
+ * @return bool
+ */
function getMetadata() {
if ( !isset( $this->metadata ) ) {
if ( !$this->getHandler() ) {
return $this->metadata;
}
+ /**
+ * @return bool|string
+ */
function getURL() {
if ( $this->repo ) {
return $this->repo->getZoneUrl( 'public' ) . '/' .
}
}
+ /**
+ * @return bool|int
+ */
function getSize() {
$this->assertRepoDefined();
$props = $this->repo->getFileProps( $this->path );