diff options
author | Daniel Hansson <mailto@danielhansson.nu> | 2023-10-09 11:54:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 11:54:03 +0200 |
commit | 06efe9f211f36798d970e57040bf5fb49086cdf6 (patch) | |
tree | e5b85a820f23499e9e21e0c47f56bba8ed863768 /lib | |
parent | cad745b0d6145e90fde04994cf4c0256089d9331 (diff) | |
parent | 6e171bbaf543c8b000f963e29f85c33f3c8350fe (diff) | |
download | nextcloud-server-06efe9f211f36798d970e57040bf5fb49086cdf6.tar.gz nextcloud-server-06efe9f211f36798d970e57040bf5fb49086cdf6.zip |
Merge pull request #40731 from nextcloud/imaginary-performance
Generate all preview sizes for Imaginary
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/Generator.php | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index b9ea5ea1a07..4a1270fa4a6 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -139,23 +139,6 @@ class Generator { $previewVersion = $file->getPreviewVersion() . '-'; } - // If imaginary is enabled, and we request a small thumbnail, - // let's not generate the max preview for performance reasons - if (count($specifications) === 1 - && ($specifications[0]['width'] <= 256 || $specifications[0]['height'] <= 256) - && preg_match(Imaginary::supportedMimeTypes(), $mimeType) - && $this->config->getSystemValueString('preview_imaginary_url', 'invalid') !== 'invalid') { - $crop = $specifications[0]['crop'] ?? false; - $preview = $this->getSmallImagePreview($previewFolder, $previewFiles, $file, $mimeType, $previewVersion, $crop); - - if ($preview->getSize() === 0) { - $preview->delete(); - throw new NotFoundException('Cached preview size 0, invalid!'); - } - - return $preview; - } - // Get the max preview and infer the max preview sizes from that $maxPreview = $this->getMaxPreview($previewFolder, $previewFiles, $file, $mimeType, $previewVersion); $maxPreviewImage = null; // only load the image when we need it @@ -232,25 +215,6 @@ class Generator { } /** - * Generate a small image straight away without generating a max preview first - * Preview generated is 256x256 - * - * @param ISimpleFile[] $previewFiles - * - * @throws NotFoundException - */ - private function getSmallImagePreview(ISimpleFolder $previewFolder, array $previewFiles, File $file, string $mimeType, string $prefix, bool $crop): ISimpleFile { - $width = 256; - $height = 256; - - try { - return $this->getCachedPreview($previewFiles, $width, $height, $crop, $mimeType, $prefix); - } catch (NotFoundException $e) { - return $this->generateProviderPreview($previewFolder, $file, $width, $height, $crop, false, $mimeType, $prefix); - } - } - - /** * Acquire a semaphore of the specified id and concurrency, blocking if necessary. * Return an identifier of the semaphore on success, which can be used to release it via * {@see Generator::unguardWithSemaphore()}. |