diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2023-06-06 23:12:40 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2023-06-23 16:27:35 +0200 |
commit | 440f882322562af6040c0c4634903574f572f146 (patch) | |
tree | 47bd477996f24fe4417ba4377e384f490250d0ea /lib/private/Preview | |
parent | 05f360c5ec76bf87f55bdbc0385aa7972ec11cbd (diff) | |
download | nextcloud-server-440f882322562af6040c0c4634903574f572f146.tar.gz nextcloud-server-440f882322562af6040c0c4634903574f572f146.zip |
feat: add width, height, crop and mode to BeforePreviewFetchedEvent
user_usage_report keeps a counter for files read.
The app uses
- OC_Filesystem::read hook
- Event listener (the legacy one) for IPreview::EVENT
Request for previews do not trigger the hook, hence the additional event listener.
The thumbnails for a list or grid view should not count, so we need the width and height.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private/Preview')
-rw-r--r-- | lib/private/Preview/Generator.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 3ce44913498..c9949c82a97 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -91,7 +91,7 @@ class Generator { * @param int $height * @param bool $crop * @param string $mode - * @param string $mimeType + * @param string|null $mimeType * @return ISimpleFile * @throws NotFoundException * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid) @@ -109,7 +109,11 @@ class Generator { new GenericEvent($file, $specification) ); $this->eventDispatcher->dispatchTyped(new BeforePreviewFetchedEvent( - $file + $file, + $width, + $height, + $crop, + $mode, )); // since we only ask for one preview, and the generate method return the last one it created, it returns the one we want |