-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add events to delegate the WebP/thumbnail generation
This allows to bypass the image adapter when generating the WebP variant and the thumbnails.
- Loading branch information
Showing
3 changed files
with
111 additions
and
42 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
wcfsetup/install/files/lib/event/file/GenerateThumbnail.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace wcf\event\file; | ||
|
||
use wcf\data\file\File; | ||
use wcf\event\IPsr14Event; | ||
use wcf\system\file\processor\ThumbnailFormat; | ||
|
||
/** | ||
* Requests the generation of a thumbnail. | ||
* | ||
* @author Alexander Ebert | ||
* @copyright 2001-2024 WoltLab GmbH | ||
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
* @since 6.1 | ||
*/ | ||
final class GenerateThumbnail implements IPsr14Event | ||
{ | ||
/** | ||
* The absolute path to the generated WebP image. | ||
*/ | ||
public ?string $filename = null; | ||
|
||
public function __construct( | ||
public readonly File $file, | ||
public readonly ThumbnailFormat $thumbnailFormat, | ||
) {} | ||
} |
26 changes: 26 additions & 0 deletions
26
wcfsetup/install/files/lib/event/file/GenerateWebpVariant.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace wcf\event\file; | ||
|
||
use wcf\data\file\File; | ||
use wcf\event\IPsr14Event; | ||
|
||
/** | ||
* Requests the generation of a WebP variant of the provided file. | ||
* | ||
* @author Alexander Ebert | ||
* @copyright 2001-2024 WoltLab GmbH | ||
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
* @since 6.1 | ||
*/ | ||
final class GenerateWebpVariant implements IPsr14Event | ||
{ | ||
/** | ||
* The absolute path to the generated WebP image. | ||
*/ | ||
public ?string $filename = null; | ||
|
||
public function __construct( | ||
public readonly File $file | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters