MediaWiki master
|
Media transform output for images. More...
Inherits MediaTransformOutput.
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 or, fallback to a span in the absence thereof. | |
Protected Attributes inherited from 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. | |
Media transform output for images.
Definition at line 37 of file ThumbnailImage.php.
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.
File | $file | |
string | $url | URL path to the thumb |
string | null | false | $path | Filesystem path to the thumb |
array | $parameters | Associative array of parameters |
Definition at line 50 of file ThumbnailImage.php.
References MediaTransformOutput\$file, $path, and $url.
ThumbnailImage::toHtml | ( | $options = [] | ) |
Return HTML.
<img ... /> tag for the thumbnail, will include width and height attributes and a blank alt text (as required).
array | $options | Associative 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 loading Specify an explicit browser loading strategy for images and iframes. 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-title-link-query Querystring parameters array, for custom-title-link custom-target-link Value of the target attribute, for custom-url-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 magnify-resource To set the HTML resource attribute, when necessary
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 121 of file ThumbnailImage.php.
References MediaTransformOutput\$responsiveUrls, $url, MediaTransformOutput\getDescLinkAttribs(), and MediaTransformOutput\linkWrap().