MediaWiki REL1_27
ThumbnailImage Class Reference

Media transform output for images. More...

Inheritance diagram for ThumbnailImage:
Collaboration diagram for ThumbnailImage:

Public Member Functions

 __construct ( $file, $url, $path=false, $parameters=[])
 Get a thumbnail object from a file and parameters.
 
 toHtml ( $options=[])
 Return HTML.
 
- Public Member Functions inherited from MediaTransformOutput
 fileIsSource ()
 Check if the output thumbnail is the same as the source.
 
 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.
 
 isError ()
 This will be overridden to return true in error classes.
 
 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 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 MediaTransformOutput
 linkWrap ( $linkAttribs, $contents)
 Wrap some XHTML text in an anchor tag with the given attributes.
 
- Protected Attributes inherited from MediaTransformOutput
File $file
 
int $height
 Image height.
 
bool string $lang
 Language code, false if not set.
 
bool string $page
 
bool string $path
 Filesystem path to the thumb

 
bool string $storagePath = false
 Permanent storage path

 
string $url
 URL path to the thumb.
 
int $width
 Image width.
 

Detailed Description

Media transform output for images.

Definition at line 277 of file MediaTransformOutput.php.

Constructor & Destructor Documentation

◆ __construct()

ThumbnailImage::__construct (   $file,
  $url,
  $path = false,
  $parameters = [] 
)

Get a thumbnail object from a file and parameters.

If $path is set to null, the output file is treated as a source copy. If $path is set to false, no output file will be created. $parameters should include, as a minimum, (file) 'width' and 'height'. It may also include a 'page' parameter for multipage files.

Parameters
File$file
string$urlURL path to the thumb
string | bool$pathFilesystem path to the thumb
array$parametersAssociative array of parameters

Definition at line 290 of file MediaTransformOutput.php.

References MediaTransformOutput\$file, MediaTransformOutput\$path, MediaTransformOutput\$url, false, file, page, and width.

Member Function Documentation

◆ toHtml()

ThumbnailImage::toHtml (   $options = [])

Return HTML.

<img ... /> tag for the thumbnail, will include width and height attributes and a blank alt text (as required).

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 HTML alt attribute title HTML title attribute desc-link Boolean, show a description link file-link Boolean, show a file download link 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 desc-query String, description link query params override-width Override width attribute. Should generally not set override-height Override height attribute. Should generally not set no-dimensions Boolean, skip width and height attributes (useful if set in CSS) custom-url-link Custom URL to link to custom-title-link Custom Title object to link to custom target-link Value of the target attribute, for custom-target-link parser-extlink-* Attributes added by parser for external links: parser-extlink-rel: add rel="nofollow" parser-extlink-target: link target, but overridden by custom-target-link

For images, desc-link and file-link are implemented as a click-through. For sounds and videos, they may be displayed in other ways.

Exceptions
MWException
Returns
string

Reimplemented from MediaTransformOutput.

Definition at line 358 of file MediaTransformOutput.php.

References $attribs, MediaTransformOutput\$height, $options, $query, $title, MediaTransformOutput\$url, MediaTransformOutput\$width, Xml\element(), file, MediaTransformOutput\getDescLinkAttribs(), MediaTransformOutput\linkWrap(), and Html\srcSet().


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