MediaWiki  REL1_23
DjVuHandler Class Reference

Handler for DjVu images. More...

Inheritance diagram for DjVuHandler:
Collaboration diagram for DjVuHandler:

List of all members.

Public Member Functions

 doTransform ($image, $dstPath, $dstUrl, $params, $flags=0)
 getDjVuImage ($image, $path)
 Cache an instance of DjVuImage in an Image object, return that instance.
 getImageSize ($image, $path)
 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.
 getMetaTree ($image, $gettext=false)
 Cache a document tree for the DjVu XML metadata.
 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)
 getParamMap ()
 getScriptParams ($params)
 getThumbType ($ext, $mime, $params=null)
 Get the thumbnail extension and MIME type for a given source MIME type.
 isEnabled ()
 isMetadataValid ($image, $metadata)
 Check if the metadata string is valid for this handler.
 isMultiPage ($file)
 makeParamString ($params)
 mustRender ($file)
 pageCount ($image)
 Page count for a multi-page document, false if unsupported or unknown.
 parseParamString ($str)
 validateParam ($name, $value)

Private Member Functions

 getUnserializedMetadata (File $file)
 Get metadata, unserializing it if neccessary.

Detailed Description

Handler for DjVu images.

Definition at line 29 of file DjVu.php.


Member Function Documentation

DjVuHandler::doTransform ( image,
dstPath,
dstUrl,
params,
flags = 0 
)
Parameters:
File$image
string$dstPath
string$dstUrl
array$params
int$flags
Returns:
MediaTransformError|ThumbnailImage|TransformParameterError

Reimplemented from MediaHandler.

Definition at line 132 of file DjVu.php.

References $flags, $params, $retval, array(), global, MediaHandler\logErrorForExternalProcess(), ImageHandler\normaliseParams(), pageCount(), MediaHandler\removeBadFile(), text, wfDebug(), wfDebugLog(), wfEscapeShellArg(), wfHostname(), wfMessage(), wfMkdirParents(), wfProfileIn(), wfProfileOut(), and wfShellExec().

DjVuHandler::getDjVuImage ( image,
path 
)

Cache an instance of DjVuImage in an Image object, return that instance.

Parameters:
File$image
string$path
Returns:
DjVuImage

Definition at line 247 of file DjVu.php.

References $path.

Referenced by getImageSize(), and getMetadata().

DjVuHandler::getImageSize ( image,
path 
)
Parameters:
File$image
string$path
Returns:
bool|array False on failure

Reimplemented from ImageHandler.

Definition at line 342 of file DjVu.php.

References $path, and getDjVuImage().

DjVuHandler::getMetadata ( image,
path 
)

Get handler-specific metadata which will be saved in the img_metadata field.

Parameters:
File$imageThe image object, or false if there isn't one. Warning, FSFile::getPropsFromPath might pass an (object)array() instead (!)
string$pathThe filename
Returns:
string

Reimplemented from MediaHandler.

Definition at line 357 of file DjVu.php.

References $path, array(), getDjVuImage(), and wfDebug().

Get a string describing the type of metadata, for display purposes.

Parameters:
File$image
Returns:
string

Reimplemented from MediaHandler.

Definition at line 368 of file DjVu.php.

DjVuHandler::getMetaTree ( image,
gettext = false 
)

Cache a document tree for the DjVu XML metadata.

Parameters:
File$image
bool$gettextDOCUMENT (Default: false)
Returns:
bool|SimpleXMLElement

Definition at line 289 of file DjVu.php.

References $e, as, getUnserializedMetadata(), isMetadataValid(), wfDebug(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by getPageDimensions(), getPageText(), and pageCount().

DjVuHandler::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.

It is expected that handlers for paged media (e.g. DjVuHandler) will override this method so that it gives the correct results for each specific page of the file, using the $page argument.

Note:
For non-paged media, use getImageSize.
Parameters:
File$image
int$pageWhat page to get dimensions of
Returns:
array|bool

Reimplemented from MediaHandler.

Definition at line 385 of file DjVu.php.

References array(), and getMetaTree().

DjVuHandler::getPageText ( image,
page 
)
Parameters:
File$image
int$pagePage number to get information for
Returns:
bool|string Page text or false when no text found.

Reimplemented from MediaHandler.

Definition at line 407 of file DjVu.php.

References getMetaTree().

Returns:
array

Reimplemented from ImageHandler.

Definition at line 63 of file DjVu.php.

References array().

Parameters:
array$params
Returns:
array

Reimplemented from ImageHandler.

Definition at line 117 of file DjVu.php.

References $params, and array().

DjVuHandler::getThumbType ( ext,
mime,
params = null 
)

Get the thumbnail extension and MIME type for a given source MIME type.

Parameters:
string$extExtension of original file
string$mimeMIME type of original file
array$paramsHandler specific rendering parameters
Returns:
array thumbnail extension and MIME type

Reimplemented from MediaHandler.

Definition at line 346 of file DjVu.php.

References $mime, array(), global, and MimeMagic\singleton().

Get metadata, unserializing it if neccessary.

Parameters:
File$fileThe DjVu file in question
Returns:
String XML metadata as a string.

Definition at line 265 of file DjVu.php.

References File\getMetadata(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by getMetaTree().

Returns:
bool

Reimplemented from MediaHandler.

Definition at line 33 of file DjVu.php.

References global, and wfDebug().

DjVuHandler::isMetadataValid ( image,
metadata 
)

Check if the metadata string is valid for this handler.

If it returns MediaHandler::METADATA_BAD (or false), Image will reload the metadata from the file and update the database. MediaHandler::METADATA_GOOD for if the metadata is a-ok, MediaHanlder::METADATA_COMPATIBLE if metadata is old but backwards compatible (which may or may not trigger a metadata reload).

Parameters:
File$image
array$metadata
Returns:
bool

Reimplemented from MediaHandler.

Definition at line 372 of file DjVu.php.

References array(), and empty.

Referenced by getMetaTree().

Parameters:
File$file
Returns:
bool

Reimplemented from MediaHandler.

Definition at line 56 of file DjVu.php.

Parameters:
array$params
Returns:
bool|string

Reimplemented from ImageHandler.

Definition at line 91 of file DjVu.php.

References $params.

Parameters:
File$file
Returns:
bool

Reimplemented from MediaHandler.

Definition at line 48 of file DjVu.php.

Page count for a multi-page document, false if unsupported or unknown.

Parameters:
File$file
Returns:
bool

Reimplemented from MediaHandler.

Definition at line 376 of file DjVu.php.

References getMetaTree().

Referenced by doTransform().

Parameters:
string$str
Returns:
array|bool

Reimplemented from ImageHandler.

Definition at line 104 of file DjVu.php.

References array().

DjVuHandler::validateParam ( name,
value 
)
Parameters:
string$name
mixed$value
Returns:
bool

Reimplemented from ImageHandler.

Definition at line 75 of file DjVu.php.

References $name, $value, and array().


The documentation for this class was generated from the following file: