Skip to content

Commit 644f795

Browse files
committed
fix: don't persist previews used during blurhash generation
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
1 parent c882d78 commit 644f795

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,11 @@ public function handle(Event $event): void {
6767
return;
6868
}
6969

70-
$image = false;
71-
try {
72-
// using preview image to generate the blurhash
73-
$preview = $this->preview->getPreview($file, 256, 256);
74-
$image = @imagecreatefromstring($preview->getContent());
75-
} catch (NotFoundException $e) {
76-
// https://github.com/nextcloud/server/blob/9d70fd3e64b60a316a03fb2b237891380c310c58/lib/private/legacy/OC_Image.php#L668
77-
// The preview system can fail on huge picture, in that case we use our own image resizer.
78-
if (str_starts_with($file->getMimetype(), 'image/')) {
79-
$image = $this->resizedImageFromFile($file);
80-
}
81-
}
82-
83-
if ($image === false) {
70+
if (!str_starts_with($file->getMimetype(), 'image/')) {
8471
return;
8572
}
8673

74+
$image = $this->resizedImageFromFile($file);
8775
$metadata->setString('blurhash', $this->generateBlurHash($image))
8876
->setEtag('blurhash', $currentEtag);
8977
}

0 commit comments

Comments
 (0)