MediaWiki  REL1_22
SvgHandler Class Reference

Handler for SVG images. More...

Inheritance diagram for SvgHandler:
Collaboration diagram for SvgHandler:

List of all members.

Public Member Functions

 canAnimateThumb ($file)
 We do not support making animated svg thumbnails.
 doTransform ($image, $dstPath, $dstUrl, $params, $flags=0)
 formatMetadata ($file)
 getImageSize ($file, $path, $metadata=false)
 getLongDesc ($file)
 Subtitle for the image.
 getMetadata ($file, $filename)
 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.
 getParamMap ()
 Get an associative array mapping magic word IDs to parameter names.
 getScriptParams ($params)
 getThumbType ($ext, $mime, $params=null)
 Get the thumbnail extension and MIME type for a given source MIME type.
 isAnimatedImage ($file)
 isEnabled ()
 False if the handler is disabled for all files.
 isMetadataValid ($image, $metadata)
 Check if the metadata string is valid for this handler.
 isVectorized ($file)
 The material is vectorized and thus scaling is lossless.
 makeParamString ($params)
 mustRender ($file)
 True if handled types cannot be displayed directly in a browser but can be rendered.
 normaliseParams ($image, &$params)
 parseParamString ($str)
 Parse a param string made with makeParamString back into an array.
 rasterize ($srcPath, $dstPath, $width, $height, $lang=false)
 Transform an SVG file to PNG This function can be called outside of thumbnail contexts.
 unpackMetadata ($metadata)
 validateParam ($name, $value)
 visibleMetadataFields ()
 Get a list of metadata items which should be displayed when the metadata table is collapsed.

Static Public Member Functions

static rasterizeImagickExt ($srcPath, $dstPath, $width, $height)

Public Attributes

const SVG_METADATA_VERSION = 2

Detailed Description

Handler for SVG images.

Definition at line 29 of file SVG.php.


Member Function Documentation

We do not support making animated svg thumbnails.

Definition at line 69 of file SVG.php.

SvgHandler::doTransform ( image,
dstPath,
dstUrl,
params,
flags = 0 
)
Parameters:
$imageFile
$dstPath
$dstUrl
$params
int$flags
Returns:
bool|MediaTransformError|ThumbnailImage|TransformParameterError

Reimplemented from MediaHandler.

Reimplemented in MockSvgHandler.

Definition at line 110 of file SVG.php.

References $flags, $params, normaliseParams(), rasterize(), text, unpackMetadata(), wfMessage(), and wfMkdirParents().

Parameters:
$fileFile
Returns:
array|bool

Reimplemented from MediaHandler.

Definition at line 321 of file SVG.php.

References $file, $name, $result, $value, MediaHandler\addMeta(), array(), as, unpackMetadata(), and visibleMetadataFields().

SvgHandler::getImageSize ( file,
path,
metadata = false 
)
Parameters:
$fileFile
$path
bool$metadata
Returns:
array

Definition at line 222 of file SVG.php.

References $file, and array().

Subtitle for the image.

Different from the base class so it can be denoted that SVG's have a "nominal" resolution, and not a fixed one, as well as so animation can be denoted.

Parameters:
$fileFile
Returns:
string

Reimplemented from ImageHandler.

Definition at line 249 of file SVG.php.

References $file, $size, $wgLang, global, isAnimatedImage(), params, unpackMetadata(), and wfMessage().

SvgHandler::getMetadata ( image,
path 
)

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

Parameters:
$imageFile: the 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 270 of file SVG.php.

References array(), and wfDebug().

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

Returns:
string

Reimplemented from MediaHandler.

Definition at line 296 of file SVG.php.

Get an associative array mapping magic word IDs to parameter names.

Will be used by the parser to identify parameters.

Reimplemented from ImageHandler.

Definition at line 420 of file SVG.php.

References array().

Parameters:
$params
Returns:
array

Reimplemented from ImageHandler.

Definition at line 428 of file SVG.php.

References $params, and array().

SvgHandler::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 236 of file SVG.php.

References array().

Parameters:
$fileFile
Returns:
bool

Reimplemented from MediaHandler.

Definition at line 54 of file SVG.php.

References $file, and unpackMetadata().

Referenced by getLongDesc().

False if the handler is disabled for all files.

Returns:
bool

Reimplemented from MediaHandler.

Definition at line 32 of file SVG.php.

References global, and wfDebug().

SvgHandler::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).

Returns:
bool

Reimplemented from MediaHandler.

Definition at line 300 of file SVG.php.

References MediaHandler\METADATA_BAD, MediaHandler\METADATA_COMPATIBLE, MediaHandler\METADATA_GOOD, and unpackMetadata().

The material is vectorized and thus scaling is lossless.

Returns:
bool

Reimplemented from MediaHandler.

Definition at line 46 of file SVG.php.

Parameters:
array$paramsname=>value pairs of parameters
Returns:
string Filename to use

Reimplemented from ImageHandler.

Definition at line 397 of file SVG.php.

References $params.

True if handled types cannot be displayed directly in a browser but can be rendered.

Returns:
bool

Reimplemented from MediaHandler.

Definition at line 42 of file SVG.php.

SvgHandler::normaliseParams ( image,
&$  params 
)
Parameters:
$imageFile
$params
Returns:
bool

Reimplemented from ImageHandler.

Definition at line 78 of file SVG.php.

References $params, global, and File\scaleHeight().

Referenced by doTransform().

Parse a param string made with makeParamString back into an array.

Parameters:
$strstring The parameter string without file name (e.g. 122px)
Returns:
Array|Boolean Array of parameters or false on failure.

Reimplemented from ImageHandler.

Definition at line 409 of file SVG.php.

References array().

SvgHandler::rasterize ( srcPath,
dstPath,
width,
height,
lang = false 
)

Transform an SVG file to PNG This function can be called outside of thumbnail contexts.

Parameters:
string$srcPath
string$dstPath
string$width
string$height
string$langLanguage code of the language to render the SVG in
Exceptions:
MWException
Returns:
bool|MediaTransformError

Definition at line 155 of file SVG.php.

References $retval, array(), global, MediaHandler\removeBadFile(), wfDebug(), wfDebugLog(), wfEscapeShellArg(), wfHostname(), wfProfileIn(), wfProfileOut(), and wfShellExecWithStderr().

Referenced by doTransform().

static SvgHandler::rasterizeImagickExt ( srcPath,
dstPath,
width,
height 
) [static]

Definition at line 202 of file SVG.php.

SvgHandler::validateParam ( name,
value 
)
Parameters:
string$nameParameter name
$string$value Parameter value
Returns:
bool Validity

Reimplemented from ImageHandler.

Definition at line 377 of file SVG.php.

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

Get a list of metadata items which should be displayed when the metadata table is collapsed.

Returns:
array of strings
Access:
protected

Reimplemented from MediaHandler.

Definition at line 312 of file SVG.php.

References array().

Referenced by formatMetadata().


Member Data Documentation

Definition at line 30 of file SVG.php.


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