Inherited by ImageHandler.
Public Member Functions | |
getParamMap () | |
Get an associative array mapping magic word IDs to parameter names. | |
validateParam ($name, $value) | |
makeParamString ($params) | |
Merge a parameter array into a string appropriate for inclusion in filenames. | |
parseParamString ($str) | |
Parse a param string made with makeParamString back into an array. | |
normaliseParams ($image, &$params) | |
Changes the parameter array as necessary, ready for transformation. | |
getImageSize ($image, $path) | |
Get an image size array like that returned by getimagesize(), or false if it can't be determined. | |
getMetadata ($image, $path) | |
Get handler-specific metadata which will be saved in the img_metadata field. | |
getMetadataType ($image) | |
Get a string describing the type of metadata, for display purposes. | |
isMetadataValid ($image, $metadata) | |
Check if the metadata string is valid for this handler. | |
getScriptedTransform ($image, $script, $params) | |
Get a MediaTransformOutput object representing an alternate of the transformed output which will call an intermediary thumbnail assist script. | |
getTransform ($image, $dstPath, $dstUrl, $params) | |
Get a MediaTransformOutput object representing the transformed output. | |
doTransform ($image, $dstPath, $dstUrl, $params, $flags=0) | |
Get a MediaTransformOutput object representing the transformed output. | |
getThumbType ($ext, $mime) | |
Get the thumbnail extension and MIME type for a given source MIME type. | |
canRender ($file) | |
True if the handled types can be transformed. | |
mustRender ($file) | |
True if handled types cannot be displayed directly in a browser but can be rendered. | |
isMultiPage ($file) | |
True if the type has multi-page capabilities. | |
pageCount ($file) | |
Page count for a multi-page document, false if unsupported or unknown. | |
isEnabled () | |
False if the handler is disabled for all files. | |
getPageDimensions ($image, $page) | |
Get an associative array of page dimensions Currently "width" and "height" are understood, but this might be expanded in the future. | |
getPageText ($image, $page) | |
Generic getter for text layer. | |
formatMetadata ($image) | |
Get an array structure that looks like this:. | |
getShortDesc ($file) | |
getLongDesc ($file) | |
getDimensionsString ($file) | |
parserTransformHook ($parser, $file) | |
Modify the parser object post-transform. | |
removeBadFile ($dstPath, $retval=0) | |
Check for zero-sized thumbnails. | |
Static Public Member Functions | |
static | getHandler ($type) |
Get a MediaHandler for a given MIME type from the instance cache. | |
static | getGeneralShortDesc ($file) |
static | getGeneralLongDesc ($file) |
Public Attributes | |
const | TRANSFORM_LATER = 1 |
Static Public Attributes | |
static | $handlers = array() |
Instance cache. | |
Static Protected Member Functions | |
static | addMeta (&$array, $visibility, $type, $id, $value, $param=false) |
Definition at line 13 of file Generic.php.
static MediaHandler::addMeta | ( | &$ | array, | |
$ | visibility, | |||
$ | type, | |||
$ | id, | |||
$ | value, | |||
$ | param = false | |||
) | [static, protected] |
Definition at line 228 of file Generic.php.
References wfMsg().
Referenced by BitmapHandler::formatMetadata().
MediaHandler::canRender | ( | $ | file | ) |
True if the handled types can be transformed.
Reimplemented in ImageHandler, and TiffHandler.
Definition at line 149 of file Generic.php.
MediaHandler::doTransform | ( | $ | image, | |
$ | dstPath, | |||
$ | dstUrl, | |||
$ | params, | |||
$ | flags = 0 | |||
) | [abstract] |
Get a MediaTransformOutput object representing the transformed output.
Does the transform unless $flags contains self::TRANSFORM_LATER.
$image | File: the image object | |
$dstPath | String: filesystem destination path | |
$dstUrl | String: destination URL to use in output HTML | |
$params | Array: arbitrary set of parameters validated by $this->validateParam() | |
$flags | Integer: a bitfield, may contain self::TRANSFORM_LATER |
Reimplemented in BitmapHandler, BitmapHandler_ClientOnly, DjVuHandler, and SvgHandler.
Referenced by ImageHandler::getTransform(), and getTransform().
MediaHandler::formatMetadata | ( | $ | image | ) |
Get an array structure that looks like this:.
array( 'visible' => array( 'Human-readable name' => 'Human readable value', ... ), 'collapsed' => array( 'Human-readable name' => 'Human readable value', ... ) ) The UI will format this into a table where the visible fields are always visible, and the collapsed fields are optionally visible.
The function should return false if there is no metadata to display. FIXME: I don't really like this interface, it's not very flexible I think the media handler should generate HTML instead. It can do all the formatting according to some standard. That makes it possible to do things like visual indication of grouped and chained streams in ogg container files.
Reimplemented in BitmapHandler, and GIFHandler.
Definition at line 216 of file Generic.php.
MediaHandler::getDimensionsString | ( | $ | file | ) |
static MediaHandler::getGeneralLongDesc | ( | $ | file | ) | [static] |
Definition at line 258 of file Generic.php.
References $wgUser, and wfMsgExt().
Referenced by File::getLongDesc().
static MediaHandler::getGeneralShortDesc | ( | $ | file | ) | [static] |
Definition at line 251 of file Generic.php.
References $wgLang, and wfMsgExt().
Referenced by File::getShortDesc().
static MediaHandler::getHandler | ( | $ | type | ) | [static] |
Get a MediaHandler for a given MIME type from the instance cache.
Definition at line 24 of file Generic.php.
References $wgMediaHandlers, isEnabled(), and wfDebug().
MediaHandler::getImageSize | ( | $ | image, | |
$ | path | |||
) | [abstract] |
Get an image size array like that returned by getimagesize(), or false if it can't be determined.
$image | File: the image object, or false if there isn't one | |
$fileName | String: the filename |
Reimplemented in BmpHandler, DjVuHandler, ImageHandler, and SvgHandler.
Referenced by getPageDimensions().
MediaHandler::getLongDesc | ( | $ | file | ) |
Reimplemented in ImageHandler, GIFHandler, and SvgHandler.
Definition at line 243 of file Generic.php.
References $wgUser, and wfMsgExt().
MediaHandler::getMetadata | ( | $ | image, | |
$ | path | |||
) |
Get handler-specific metadata which will be saved in the img_metadata field.
$image | File: the image object, or false if there isn't one | |
$path | String: the filename |
Reimplemented in BitmapHandler, DjVuHandler, and GIFHandler.
Definition at line 87 of file Generic.php.
MediaHandler::getMetadataType | ( | $ | image | ) |
Get a string describing the type of metadata, for display purposes.
Reimplemented in BitmapHandler, DjVuHandler, and GIFHandler.
Definition at line 92 of file Generic.php.
MediaHandler::getPageDimensions | ( | $ | image, | |
$ | page | |||
) |
Get an associative array of page dimensions Currently "width" and "height" are understood, but this might be expanded in the future.
Returns false if unknown or if the document is not multi-page.
Reimplemented in DjVuHandler.
Definition at line 174 of file Generic.php.
References getImageSize().
MediaHandler::getPageText | ( | $ | image, | |
$ | page | |||
) |
Generic getter for text layer.
Currently overloaded by PDF and DjVu handlers
Reimplemented in DjVuHandler.
Definition at line 186 of file Generic.php.
MediaHandler::getParamMap | ( | ) | [abstract] |
Get an associative array mapping magic word IDs to parameter names.
Will be used by the parser to identify parameters.
Reimplemented in DjVuHandler, and ImageHandler.
MediaHandler::getScriptedTransform | ( | $ | image, | |
$ | script, | |||
$ | params | |||
) |
Get a MediaTransformOutput object representing an alternate of the transformed output which will call an intermediary thumbnail assist script.
Used when the repository has a thumbnailScriptUrl option configured.
Return false to fall back to the regular getTransform().
Reimplemented in ImageHandler.
Definition at line 109 of file Generic.php.
MediaHandler::getShortDesc | ( | $ | file | ) |
Reimplemented in ImageHandler.
Definition at line 236 of file Generic.php.
References $wgLang, and wfMsgExt().
MediaHandler::getThumbType | ( | $ | ext, | |
$ | mime | |||
) |
Get the thumbnail extension and MIME type for a given source MIME type.
Reimplemented in BmpHandler, DjVuHandler, SvgHandler, and TiffHandler.
Definition at line 142 of file Generic.php.
References $ext.
MediaHandler::getTransform | ( | $ | image, | |
$ | dstPath, | |||
$ | dstUrl, | |||
$ | params | |||
) |
Get a MediaTransformOutput object representing the transformed output.
Does not actually do the transform.
$image | File: the image object | |
$dstPath | String: filesystem destination path | |
$dstUrl | String: Destination URL to use in output HTML | |
$params | Array: Arbitrary set of parameters validated by $this->validateParam() |
Reimplemented in ImageHandler.
Definition at line 122 of file Generic.php.
References doTransform().
MediaHandler::isEnabled | ( | ) |
False if the handler is disabled for all files.
Reimplemented in DjVuHandler, and SvgHandler.
Definition at line 166 of file Generic.php.
Referenced by getHandler().
MediaHandler::isMetadataValid | ( | $ | image, | |
$ | metadata | |||
) |
Check if the metadata string is valid for this handler.
If it returns false, Image will reload the metadata from the file and update the database
Reimplemented in BitmapHandler, and DjVuHandler.
Definition at line 98 of file Generic.php.
MediaHandler::isMultiPage | ( | $ | file | ) |
True if the type has multi-page capabilities.
Reimplemented in DjVuHandler.
Definition at line 158 of file Generic.php.
MediaHandler::makeParamString | ( | $ | params | ) | [abstract] |
Merge a parameter array into a string appropriate for inclusion in filenames.
Reimplemented in DjVuHandler, and ImageHandler.
MediaHandler::mustRender | ( | $ | file | ) |
True if handled types cannot be displayed directly in a browser but can be rendered.
Reimplemented in BmpHandler, DjVuHandler, SvgHandler, and TiffHandler.
Definition at line 154 of file Generic.php.
MediaHandler::normaliseParams | ( | $ | image, | |
&$ | params | |||
) | [abstract] |
Changes the parameter array as necessary, ready for transformation.
Should be idempotent. Returns false if the parameters are unacceptable and the transform should fail
Reimplemented in BitmapHandler, BitmapHandler_ClientOnly, ImageHandler, and SvgHandler.
MediaHandler::pageCount | ( | $ | file | ) |
Page count for a multi-page document, false if unsupported or unknown.
Reimplemented in DjVuHandler.
Definition at line 162 of file Generic.php.
MediaHandler::parseParamString | ( | $ | str | ) | [abstract] |
Parse a param string made with makeParamString back into an array.
Reimplemented in DjVuHandler, and ImageHandler.
MediaHandler::parserTransformHook | ( | $ | parser, | |
$ | file | |||
) |
MediaHandler::removeBadFile | ( | $ | dstPath, | |
$ | retval = 0 | |||
) |
Check for zero-sized thumbnails.
These can be generated when no disk space is available or some other error occurs
$dstPath | The location of the suspect file | |
$retval | Return value of some shell process, file will be deleted if this is non-zero |
Definition at line 283 of file Generic.php.
References wfDebugLog().
Referenced by DjVuHandler::doTransform(), BitmapHandler::doTransform(), and SvgHandler::rasterize().
MediaHandler::validateParam | ( | $ | name, | |
$ | value | |||
) | [abstract] |
Reimplemented in DjVuHandler, and ImageHandler.
MediaHandler::$handlers = array() [static] |
const MediaHandler::TRANSFORM_LATER = 1 |
Definition at line 14 of file Generic.php.