From cfe057a60380cf0452acfa35fe4ab3c5128b5aa4 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 27 Mar 2013 12:48:08 -0700 Subject: [PATCH] Made sure MediaTransformOutput::getLocalCopyPath handles storage paths. * Storage paths are passed in for several cases in File::transform(). Change-Id: I61a4058b80a37f36b78e2dfe62ffdf6f73e6f41e --- includes/filerepo/file/File.php | 3 +-- includes/media/MediaTransformOutput.php | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 5eff954f9d..d72755a468 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -910,8 +910,7 @@ abstract class File { // XXX: Pass in the storage path even though we are not rendering anything // and the path is supposed to be an FS path. This is due to getScalerType() // getting called on the path and clobbering $thumb->getUrl() if it's false. - $thumb = $handler->getTransform( - $this, $thumbPath, $thumbUrl, $params ); + $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); $thumb->setStoragePath( $thumbPath ); break; } diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index 1f95bc3bad..1c2dfdd22b 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -151,7 +151,12 @@ abstract class MediaTransformOutput { if ( $this->isError() ) { return false; } elseif ( $this->path === null ) { - return $this->file->getLocalRefPath(); + return $this->file->getLocalRefPath(); // assume thumb was not scaled + } elseif ( FileBackend::isStoragePath( $this->path ) ) { + $be = $this->file->getRepo()->getBackend(); + // The temp file will be process cached by FileBackend + $fsFile = $be->getLocalReference( array( 'src' => $this->path ) ); + return $fsFile ? $fsFile->getPath() : false; } else { return $this->path; // may return false } -- 2.20.1