MediaWiki  1.23.12
MediaTransformOutput Class Reference

Base class for the output of MediaHandler::doTransform() and File::transform(). More...

Inheritance diagram for MediaTransformOutput:
Collaboration diagram for MediaTransformOutput:

Public Member Functions

 fileIsSource ()
 Check if the output thumbnail is the same as the source. More...
 
 getDescLinkAttribs ( $title=null, $params=array())
 
 getExtension ()
 Get the final extension of the thumbnail. More...
 
 getFile ()
 
 getHeight ()
 
 getLocalCopyPath ()
 Get the path of a file system copy of the thumbnail. More...
 
 getStoragePath ()
 
 getUrl ()
 
 getWidth ()
 
 hasFile ()
 Check if an output thumbnail file actually exists. More...
 
 isError ()
 This will be overridden to return true in error classes. More...
 
 setStoragePath ( $storagePath)
 
 streamFile ( $headers=array())
 Stream the file if there were no errors. More...
 
 toHtml ( $options=array())
 Fetch HTML for this transform output. More...
 

Public Attributes

array $responsiveUrls = array()
 Associative array mapping optional supplementary image files from pixel density (eg 1.5 or 2) to additional URLs. More...
 

Protected Member Functions

 linkWrap ( $linkAttribs, $contents)
 Wrap some XHTML text in an anchor tag with the given attributes. More...
 

Protected Attributes

File $file
 object * More...
 
int $height
 Image height *. More...
 
bool string $lang
 Language code, false if not set *. More...
 
bool string $page
 
bool string $path
 Filesystem path to the thumb *. More...
 
bool string $storagePath = false
 Permanent storage path *. More...
 
string $url
 URL path to the thumb *. More...
 
int $width
 Image width *. More...
 

Detailed Description

Base class for the output of MediaHandler::doTransform() and File::transform().

Definition at line 29 of file MediaTransformOutput.php.

Member Function Documentation

◆ fileIsSource()

MediaTransformOutput::fileIsSource ( )

Check if the output thumbnail is the same as the source.

This can occur if the requested width was bigger than the source.

Returns
bool

Definition at line 152 of file MediaTransformOutput.php.

References isError().

◆ getDescLinkAttribs()

MediaTransformOutput::getDescLinkAttribs (   $title = null,
  $params = array() 
)
Parameters
$titlestring
string | array$paramsQuery parameters to add
Returns
array

Definition at line 216 of file MediaTransformOutput.php.

References $attribs, $lang, $page, $params, $query, $title, array(), file, page, and wfArrayToCgi().

Referenced by ThumbnailImage\toHtml().

◆ getExtension()

MediaTransformOutput::getExtension ( )

Get the final extension of the thumbnail.

Returns false for scripted transformations.

Returns
string|false

Definition at line 76 of file MediaTransformOutput.php.

References FileBackend\extensionFromPath().

◆ getFile()

MediaTransformOutput::getFile ( )
Returns
File file

Definition at line 67 of file MediaTransformOutput.php.

References $file.

◆ getHeight()

MediaTransformOutput::getHeight ( )
Returns
int Height of the output box

Definition at line 60 of file MediaTransformOutput.php.

References $height.

◆ getLocalCopyPath()

MediaTransformOutput::getLocalCopyPath ( )

Get the path of a file system copy of the thumbnail.

Callers should never write to this path.

Returns
string|bool Returns false if there isn't one

Definition at line 162 of file MediaTransformOutput.php.

References $path, array(), file, isError(), and FileBackend\isStoragePath().

Referenced by streamFile().

◆ getStoragePath()

MediaTransformOutput::getStoragePath ( )
Returns
string|bool The permanent thumbnail storage path

Definition at line 90 of file MediaTransformOutput.php.

References $storagePath.

◆ getUrl()

MediaTransformOutput::getUrl ( )
Returns
string|false The thumbnail URL

Definition at line 83 of file MediaTransformOutput.php.

References $url.

◆ getWidth()

MediaTransformOutput::getWidth ( )
Returns
int Width of the output box

Definition at line 53 of file MediaTransformOutput.php.

References $width.

◆ hasFile()

MediaTransformOutput::hasFile ( )

Check if an output thumbnail file actually exists.

This will return false if there was an error, the thumbnail is to be handled client-side only, or if transformation was deferred via TRANSFORM_LATER.

Returns
bool

Definition at line 140 of file MediaTransformOutput.php.

References isError().

◆ isError()

MediaTransformOutput::isError ( )

This will be overridden to return true in error classes.

Returns
bool

Reimplemented in MediaTransformError.

Definition at line 128 of file MediaTransformOutput.php.

Referenced by fileIsSource(), getLocalCopyPath(), and hasFile().

◆ linkWrap()

MediaTransformOutput::linkWrap (   $linkAttribs,
  $contents 
)
protected

Wrap some XHTML text in an anchor tag with the given attributes.

Parameters
array$linkAttribs
string$contents
Returns
string

Definition at line 203 of file MediaTransformOutput.php.

References Xml\tags().

Referenced by ThumbnailImage\toHtml().

◆ setStoragePath()

MediaTransformOutput::setStoragePath (   $storagePath)
Parameters
string$storagePathThe permanent storage path
Returns
void

Definition at line 98 of file MediaTransformOutput.php.

References $storagePath.

◆ streamFile()

MediaTransformOutput::streamFile (   $headers = array())

Stream the file if there were no errors.

Parameters
array$headersAdditional HTTP headers to send on success
Returns
bool Success

Definition at line 184 of file MediaTransformOutput.php.

References array(), file, getLocalCopyPath(), FileBackend\isStoragePath(), and StreamFile\stream().

◆ toHtml()

MediaTransformOutput::toHtml (   $options = array())
abstract

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 in MediaTransformError, and ThumbnailImage.

Member Data Documentation

◆ $file

File MediaTransformOutput::$file
protected

object *

Definition at line 34 of file MediaTransformOutput.php.

Referenced by ThumbnailImage\__construct(), and getFile().

◆ $height

int MediaTransformOutput::$height
protected

Image height *.

Definition at line 38 of file MediaTransformOutput.php.

Referenced by MediaTransformError\__construct(), getHeight(), and ThumbnailImage\toHtml().

◆ $lang

bool string MediaTransformOutput::$lang
protected

Language code, false if not set *.

Definition at line 46 of file MediaTransformOutput.php.

Referenced by getDescLinkAttribs().

◆ $page

bool string MediaTransformOutput::$page
protected

Definition at line 42 of file MediaTransformOutput.php.

Referenced by getDescLinkAttribs().

◆ $path

bool string MediaTransformOutput::$path
protected

Filesystem path to the thumb *.

Definition at line 44 of file MediaTransformOutput.php.

Referenced by ThumbnailImage\__construct(), and getLocalCopyPath().

◆ $responsiveUrls

array MediaTransformOutput::$responsiveUrls = array()

Associative array mapping optional supplementary image files from pixel density (eg 1.5 or 2) to additional URLs.

Definition at line 32 of file MediaTransformOutput.php.

◆ $storagePath

bool string MediaTransformOutput::$storagePath = false
protected

Permanent storage path *.

Definition at line 48 of file MediaTransformOutput.php.

Referenced by getStoragePath(), and setStoragePath().

◆ $url

string MediaTransformOutput::$url
protected

URL path to the thumb *.

Definition at line 40 of file MediaTransformOutput.php.

Referenced by ThumbnailImage\__construct(), and getUrl().

◆ $width

int MediaTransformOutput::$width
protected

Image width *.

Definition at line 36 of file MediaTransformOutput.php.

Referenced by MediaTransformError\__construct(), getWidth(), and ThumbnailImage\toHtml().


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