MediaWiki  REL1_31
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. More...
 toHtml ( $options=[])
 Return HTML. More...
- Public Member Functions inherited from MediaTransformOutput
 fileIsSource ()
 Check if the output thumbnail is the same as the source. More...
 getDescLinkAttribs ( $title=null, $params=[])
 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=[])
 Stream the file if there were no errors. More...
 streamFileWithStatus ( $headers=[])
 Stream the file if there were no errors. More...

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. More...
- Protected Member Functions inherited from MediaTransformOutput
 linkWrap ( $linkAttribs, $contents)
 Wrap some XHTML text in an anchor tag with the given attributes. More...
- Protected Attributes inherited from MediaTransformOutput
File $file
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

Media transform output for images.

Definition at line 277 of file MediaTransformOutput.php.

Constructor & Destructor Documentation

◆ __construct()

ThumbnailImage::__construct (   $file,
  $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.

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

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.


Reimplemented from MediaTransformOutput.

Definition at line 358 of file MediaTransformOutput.php.

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

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