diff --git a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php index 61ace449453b5..83ba0f32f41d5 100644 --- a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php +++ b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php @@ -67,23 +67,11 @@ public function handle(Event $event): void { return; } - $image = false; - try { - // using preview image to generate the blurhash - $preview = $this->preview->getPreview($file, 256, 256); - $image = @imagecreatefromstring($preview->getContent()); - } catch (NotFoundException $e) { - // https://github.com/nextcloud/server/blob/9d70fd3e64b60a316a03fb2b237891380c310c58/lib/private/legacy/OC_Image.php#L668 - // The preview system can fail on huge picture, in that case we use our own image resizer. - if (str_starts_with($file->getMimetype(), 'image/')) { - $image = $this->resizedImageFromFile($file); - } - } - - if ($image === false) { + if (!str_starts_with($file->getMimetype(), 'image/')) { return; } + $image = $this->resizedImageFromFile($file); $metadata->setString('blurhash', $this->generateBlurHash($image)) ->setEtag('blurhash', $currentEtag); }