(bug 38376) call to undefined method ThumbnailImage::getPath()
* Added MediaTransformOutput::getExtension() function and use it instead. * Also fixed getScriptedTransform() to not pass the page as the path parameter. Change-Id: I6c530aa155d62a6bfd5727c6f3d104fe91453745
This commit is contained in:
parent
d949fb0993
commit
87524b1e75
3 changed files with 18 additions and 9 deletions
|
|
@ -356,8 +356,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
|
||||
if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
|
||||
list( $ext, $mime ) = $file->getHandler()->getThumbType(
|
||||
substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ),
|
||||
$file->getMimeType(), $thumbParams );
|
||||
$mto->getExtension(), $file->getMimeType(), $thumbParams );
|
||||
$vals['thumbmime'] = $mime;
|
||||
}
|
||||
} elseif ( $mto && $mto->isError() ) {
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ abstract class MediaHandler {
|
|||
|
||||
/**
|
||||
* Remove files from the purge list
|
||||
*
|
||||
*
|
||||
* @param array $files
|
||||
* @param array $options
|
||||
*/
|
||||
|
|
@ -717,7 +717,8 @@ abstract class ImageHandler extends MediaHandler {
|
|||
$page = isset( $params['page'] ) ? $params['page'] : false;
|
||||
|
||||
if( $image->mustRender() || $params['width'] < $image->getWidth() ) {
|
||||
return new ThumbnailImage( $image, $url, $params['width'], $params['height'], $page );
|
||||
return new ThumbnailImage( $image,
|
||||
$url, $params['width'], $params['height'], false, $page );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,21 +36,30 @@ abstract class MediaTransformOutput {
|
|||
protected $storagePath = false;
|
||||
|
||||
/**
|
||||
* Get the width of the output box
|
||||
* @return integer Width of the output box
|
||||
*/
|
||||
public function getWidth() {
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of the output box
|
||||
* @return integer Height of the output box
|
||||
*/
|
||||
public function getHeight() {
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The thumbnail URL
|
||||
* Get the final extension of the thumbnail.
|
||||
* Returns false for scripted transformations.
|
||||
* @return string|false
|
||||
*/
|
||||
public function getExtension() {
|
||||
return $this->path ? FileBackend::extensionFromPath( $this->path ) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|false The thumbnail URL
|
||||
*/
|
||||
public function getUrl() {
|
||||
return $this->url;
|
||||
|
|
@ -106,7 +115,7 @@ abstract class MediaTransformOutput {
|
|||
* 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.
|
||||
*
|
||||
*
|
||||
* @return Bool
|
||||
*/
|
||||
public function hasFile() {
|
||||
|
|
@ -198,7 +207,7 @@ class ThumbnailImage extends MediaTransformOutput {
|
|||
* 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.
|
||||
*
|
||||
*
|
||||
* @param $file File object
|
||||
* @param $url String: URL path to the thumb
|
||||
* @param $width Integer: file's width
|
||||
|
|
|
|||
Loading…
Reference in a new issue