Merge "Added/Removed spaces around string concatenation"
[lhc/web/wiklou.git] / includes / media / MediaTransformOutput.php
index 1f95bc3..2616edb 100644 (file)
@@ -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
                }
@@ -296,7 +301,7 @@ class ThumbnailImage extends MediaTransformOutput {
         */
        function toHtml( $options = array() ) {
                if ( count( func_get_args() ) == 2 ) {
-                       throw new MWException( __METHOD__ .' called in the old style' );
+                       throw new MWException( __METHOD__ . ' called in the old style' );
                }
 
                $alt = empty( $options['alt'] ) ? '' : $options['alt'];