From 0f193385354446ff0a644aaaf887bd710b53bb6e Mon Sep 17 00:00:00 2001 From: Aaron Date: Mon, 23 Apr 2012 11:06:05 -0700 Subject: [PATCH] [FileRepo] Added hook to let us copy thumbnails into additional places as they are transformed. Change-Id: I673faf338e58c8230ab6da5243f921c178c47e97 --- docs/hooks.txt | 6 ++++++ includes/filerepo/file/File.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index d87bd3d3f2..d693caf4fc 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -899,6 +899,12 @@ $article: in case all revisions of the file are deleted a reference to the $user: user who performed the deletion $reason: reason +'FileTransformed': When a file is transformed and moved into storage +$file: reference to the File object +$thumb: the MediaTransformOutput object +$tmpThumbPath: The temporary file system path of the transformed file +$thumbPath: The permanent storage path of the transformed file + 'FileUpload': When a file upload occurs $file : Image object representing the file that was uploaded $reupload : Boolean indicating if there was a previously another image there or not (since 1.17) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index ae11e673d9..8c9f7ff9b2 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -871,6 +871,8 @@ abstract class File { } else { $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ); } + // Give extensions a chance to do something with this thumbnail... + wfRunHooks( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) ); } // Purge. Useful in the event of Core -> Squid connection failure or squid -- 2.20.1