Skip to content

Commit ff69b68

Browse files
committed
feat(blurhash): notice on big images
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent 78865e3 commit ff69b68

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use OCP\FilesMetadata\Event\MetadataLiveEvent;
2222
use OCP\IPreview;
2323
use OCP\Lock\LockedException;
24+
use Psr\Log\LoggerInterface;
2425

2526
/**
2627
* Generate a Blurhash string as metadata when image file is uploaded/edited.
@@ -33,6 +34,7 @@ class GenerateBlurhashMetadata implements IEventListener {
3334

3435
public function __construct(
3536
private IPreview $preview,
37+
private readonly LoggerInterface $logger,
3638
) {
3739
}
3840

@@ -93,6 +95,10 @@ public function generateBlurHash(GdImage $image): string {
9395
$width = imagesx($image);
9496
$height = imagesy($image);
9597

98+
if (max($width, $height) > 64) {
99+
$this->logger->notice('blurhash should be generated using 64x64 preview');
100+
}
101+
96102
$pixels = [];
97103
for ($y = 0; $y < $height; ++$y) {
98104
$row = [];

0 commit comments

Comments
 (0)