|
MediaWiki master
|
Base class for the output of MediaHandler::doTransform() and File::transform(). More...
Inherited by MediaWiki\Media\MediaTransformError, and MediaWiki\Media\ThumbnailImage.

Public Member Functions | |
| 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. | |
| 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. | |
| toHtml ( $options=[]) | |
| Fetch HTML for this transform output. | |
Public Attributes | |
| array | $responsiveUrls = [] |
| Associative array mapping optional supplementary image files from pixel density (eg 1.5 or 2) to additional URLs. | |
Protected Member Functions | |
| 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 | |
| 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. | |
Base class for the output of MediaHandler::doTransform() and File::transform().
Definition at line 25 of file MediaTransformOutput.php.
| MediaWiki\Media\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.
Definition at line 188 of file MediaTransformOutput.php.
| MediaWiki\Media\MediaTransformOutput::getAttribs | ( | array | $options = [] | ) |
Return extra attributes that should be present on the media tag in the HTML.
Takes the same option array as ::toHtml() (and should be used by the implementation of ::toHtml()).
| array | $options | See options parameter of ::toHtml() |
Reimplemented in MediaWiki\Media\ThumbnailImage.
Definition at line 131 of file MediaTransformOutput.php.
| MediaWiki\Media\MediaTransformOutput::getDescLinkAttribs | ( | $title = null, | |
| $params = [] ) |
| string | null | $title | |
| string | array | $params | Query parameters to add |
Definition at line 283 of file MediaTransformOutput.php.
References wfArrayToCgi().
| MediaWiki\Media\MediaTransformOutput::getExtension | ( | ) |
Get the final extension of the thumbnail.
Returns false for scripted transformations.
Definition at line 83 of file MediaTransformOutput.php.
References Wikimedia\FileBackend\FileBackend\extensionFromPath().
| MediaWiki\Media\MediaTransformOutput::getFile | ( | ) |
Definition at line 72 of file MediaTransformOutput.php.
References MediaWiki\Media\MediaTransformOutput\$file.
Referenced by MediaWiki\Media\MediaTransformOutput\getUrl().
| MediaWiki\Media\MediaTransformOutput::getHeight | ( | ) |
Definition at line 65 of file MediaTransformOutput.php.
References MediaWiki\Media\MediaTransformOutput\$height.
| MediaWiki\Media\MediaTransformOutput::getLocalCopyPath | ( | ) |
Get the path of a file system copy of the thumbnail.
Callers should never write to this path.
Definition at line 198 of file MediaTransformOutput.php.
References $path, and Wikimedia\FileBackend\FileBackend\isStoragePath().
| MediaWiki\Media\MediaTransformOutput::getStoragePath | ( | ) |
Definition at line 107 of file MediaTransformOutput.php.
References MediaWiki\Media\MediaTransformOutput\$storagePath.
| MediaWiki\Media\MediaTransformOutput::getUrl | ( | ) |
Definition at line 92 of file MediaTransformOutput.php.
References MediaWiki\Media\MediaTransformOutput\getFile().
| MediaWiki\Media\MediaTransformOutput::getWidth | ( | ) |
Definition at line 58 of file MediaTransformOutput.php.
References MediaWiki\Media\MediaTransformOutput\$width.
| MediaWiki\Media\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. This file may exist as a new file in /tmp, a file in permanent storage, or even refer to the original.
Definition at line 176 of file MediaTransformOutput.php.
| MediaWiki\Media\MediaTransformOutput::isError | ( | ) |
This will be overridden to return true in error classes.
Reimplemented in MediaWiki\Media\MediaTransformError.
Definition at line 161 of file MediaTransformOutput.php.
|
protected |
Wrap some XHTML text in an anchor tag with the given attributes or, fallback to a span in the absence thereof.
| array | $linkAttribs | |
| string | $contents |
Definition at line 271 of file MediaTransformOutput.php.
| MediaWiki\Media\MediaTransformOutput::setStoragePath | ( | $storagePath | ) |
| string | $storagePath | The permanent storage path |
Definition at line 117 of file MediaTransformOutput.php.
References MediaWiki\Media\MediaTransformOutput\$storagePath.
| MediaWiki\Media\MediaTransformOutput::streamFile | ( | $headers = [] | ) |
Stream the file if there were no errors.
| array | $headers | Additional HTTP headers to send on success |
Definition at line 258 of file MediaTransformOutput.php.
References wfDeprecated().
| MediaWiki\Media\MediaTransformOutput::streamFileWithStatus | ( | $headers = [] | ) |
Stream the file if there were no errors.
| array | $headers | Additional HTTP headers to send on success |
Definition at line 225 of file MediaTransformOutput.php.
References $success, Wikimedia\FileBackend\FileBackend\isStoragePath(), and Wikimedia\FileBackend\HTTPFileStreamer\stream().
|
abstract |
Fetch HTML for this transform output.
| array | $options | Associative array of options. Boolean options should be indicated with a value of true for true, and false or absent for false. |
<img> tag, if there is such a tagFor images, desc-link and file-link are implemented as a click-through. For sounds and videos, they may be displayed in other ways.
Reimplemented in MediaWiki\Media\MediaTransformError, and MediaWiki\Media\ThumbnailImage.
|
protected |
Definition at line 32 of file MediaTransformOutput.php.
Referenced by MediaWiki\Media\ThumbnailImage\__construct(), and MediaWiki\Media\MediaTransformOutput\getFile().
|
protected |
Image height.
Definition at line 38 of file MediaTransformOutput.php.
Referenced by MediaWiki\Media\MediaTransformError\__construct(), and MediaWiki\Media\MediaTransformOutput\getHeight().
|
protected |
Language code, false if not set.
Definition at line 50 of file MediaTransformOutput.php.
|
protected |
Definition at line 44 of file MediaTransformOutput.php.
|
protected |
Filesystem path to the thumb.
Definition at line 47 of file MediaTransformOutput.php.
Referenced by MediaWiki\Media\ThumbnailImage\__construct().
| array MediaWiki\Media\MediaTransformOutput::$responsiveUrls = [] |
Associative array mapping optional supplementary image files from pixel density (eg 1.5 or 2) to additional URLs.
Definition at line 29 of file MediaTransformOutput.php.
|
protected |
Permanent storage path.
Definition at line 53 of file MediaTransformOutput.php.
Referenced by MediaWiki\Media\MediaTransformOutput\getStoragePath(), and MediaWiki\Media\MediaTransformOutput\setStoragePath().
|
protected |
URL path to the thumb.
Definition at line 41 of file MediaTransformOutput.php.
Referenced by MediaWiki\Media\ThumbnailImage\__construct().
|
protected |
Image width.
Definition at line 35 of file MediaTransformOutput.php.
Referenced by MediaWiki\Media\MediaTransformError\__construct(), and MediaWiki\Media\MediaTransformOutput\getWidth().