mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Generate small preview straight away if Imaginary is enabled
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
b88dc5ff2e
commit
3d1f22f6d8
1 changed files with 7 additions and 2 deletions
|
|
@ -137,9 +137,10 @@ 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'] === 250 && $specifications[0]['height'] === 250)
|
||||
|| ($specifications[0]['width'] === 150 && $specifications[0]['height'] === 150))
|
||||
&& ($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;
|
||||
|
|
@ -221,6 +222,10 @@ class Generator {
|
|||
return $preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a small image straight away without generating a max preview first
|
||||
* Preview generated is 256x256
|
||||
*/
|
||||
private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file, string $mimeType, string $prefix, bool $crop) {
|
||||
$nodes = $previewFolder->getDirectoryListing();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue