MediaWiki master
MediaWiki\Media\MediaTransformError Class Reference

Basic media transform error class. More...

Inherits MediaWiki\Media\MediaTransformOutput.

Inherited by MediaWiki\Media\TransformParameterError, and MediaWiki\Media\TransformTooBigImageAreaError.

Collaboration diagram for MediaWiki\Media\MediaTransformError:

Public Member Functions

 __construct ( $msg, $width, $height,... $args)
 getHtmlMsg ()
 getHttpStatusCode ()
 getMsg ()
 isError ()
 This will be overridden to return true in error classes.
Returns
bool

 toHtml ( $options=[])
 Fetch HTML for this transform output.
Parameters
array$optionsAssociative array of options. Boolean options should be indicated with a value of true for true, and false or absent for false.
  • alt : Alternate text or caption
  • desc-link : Boolean, show a description link
  • file-link : Boolean, show a file download link
  • custom-url-link : Custom URL to link to
  • custom-title-link : Custom Title object to link to
  • valign : vertical-align property, if the output is an inline element
  • img-class : Class applied to the <img> tag, if there is such a tag
For images, desc-link and file-link are implemented as a click-through. For sounds and videos, they may be displayed in other ways.
Returns
string

 toText ()
Public Member Functions inherited from MediaWiki\Media\MediaTransformOutput
 fileIsSource ()
 Check if the output thumbnail is the same as the source.
 getAttribs (array $options=[])
 Return extra attributes that should be present on the media tag in the HTML.
 getDescLinkAttribs ( $title=null, $params=[])
 getExtension ()
 Get the final extension of the thumbnail.
 getFile ()
 getHeight ()
 getLocalCopyPath ()
 Get the path of a file system copy of the thumbnail.
 getStoragePath ()
 getUrl ()
 getWidth ()
 hasFile ()
 Check if an output thumbnail file actually exists.
 setStoragePath ( $storagePath)
 streamFile ( $headers=[])
 Stream the file if there were no errors.
 streamFileWithStatus ( $headers=[])
 Stream the file if there were no errors.

Additional Inherited Members

Public Attributes inherited from MediaWiki\Media\MediaTransformOutput
array $responsiveUrls = []
 Associative array mapping optional supplementary image files from pixel density (eg 1.5 or 2) to additional URLs.
Protected Member Functions inherited from MediaWiki\Media\MediaTransformOutput
 linkWrap ( $linkAttribs, $contents)
 Wrap some XHTML text in an anchor tag with the given attributes or, fallback to a span in the absence thereof.
Protected Attributes inherited from MediaWiki\Media\MediaTransformOutput
File $file
int $height
 Image height.
string false $lang
 Language code, false if not set.
string false $page
string null false $path
 Filesystem path to the thumb.
string false $storagePath = false
 Permanent storage path.
string false $url
 URL path to the thumb.
int $width
 Image width.

Detailed Description

Basic media transform error class.

Stability: newable
Stability: stable
to extend

Definition at line 23 of file MediaTransformError.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Media\MediaTransformError::__construct ( $msg,
$width,
$height,
... )
Stability: stable
to call
Parameters
string | MessageSpecifier$msg
int$width
int$height
MessageParam|MessageSpecifier|string|int|float...$args

Definition at line 35 of file MediaTransformError.php.

References MediaWiki\Media\MediaTransformOutput\$height, MediaWiki\Media\MediaTransformOutput\$width, and wfMessage().

Member Function Documentation

◆ getHtmlMsg()

MediaWiki\Media\MediaTransformError::getHtmlMsg ( )
Returns
string

Definition at line 61 of file MediaTransformError.php.

Referenced by toHtml().

◆ getHttpStatusCode()

MediaWiki\Media\MediaTransformError::getHttpStatusCode ( )
Stability: stable
to override
Returns
int

Reimplemented in MediaWiki\Media\TransformParameterError, and MediaWiki\Media\TransformTooBigImageAreaError.

Definition at line 82 of file MediaTransformError.php.

◆ getMsg()

MediaWiki\Media\MediaTransformError::getMsg ( )
Returns
Message

Definition at line 68 of file MediaTransformError.php.

◆ isError()

MediaWiki\Media\MediaTransformError::isError ( )

This will be overridden to return true in error classes.

Returns
bool

Reimplemented from MediaWiki\Media\MediaTransformOutput.

Definition at line 73 of file MediaTransformError.php.

◆ toHtml()

MediaWiki\Media\MediaTransformError::toHtml ( $options = [])

Fetch HTML for this transform output.

Parameters
array$optionsAssociative array of options. Boolean options should be indicated with a value of true for true, and false or absent for false.
  • alt : Alternate text or caption
  • desc-link : Boolean, show a description link
  • file-link : Boolean, show a file download link
  • custom-url-link : Custom URL to link to
  • custom-title-link : Custom Title object to link to
  • valign : vertical-align property, if the output is an inline element
  • img-class : Class applied to the <img> tag, if there is such a tag
For images, desc-link and file-link are implemented as a click-through. For sounds and videos, they may be displayed in other ways.
Returns
string

Reimplemented from MediaWiki\Media\MediaTransformOutput.

Definition at line 44 of file MediaTransformError.php.

References getHtmlMsg().

◆ toText()

MediaWiki\Media\MediaTransformError::toText ( )
Returns
string

Definition at line 54 of file MediaTransformError.php.


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