mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
feat: Imaginary WebP support
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
12f57ada7d
commit
80abec668b
2 changed files with 21 additions and 1 deletions
|
|
@ -651,6 +651,8 @@ class Generator {
|
|||
return 'png';
|
||||
case 'image/jpeg':
|
||||
return 'jpg';
|
||||
case 'image/webp':
|
||||
return 'webp';
|
||||
case 'image/gif':
|
||||
return 'gif';
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -106,6 +106,15 @@ class Imaginary extends ProviderV2 {
|
|||
$mimeType = 'jpeg';
|
||||
}
|
||||
|
||||
$preview_format = $this->config->getSystemValueString('preview_format', 'jpeg');
|
||||
|
||||
switch ($preview_format) { // Change the format to the correct one
|
||||
case 'webp':
|
||||
$mimeType = 'webp';
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
$operations = [];
|
||||
|
||||
if ($convert) {
|
||||
|
|
@ -121,7 +130,16 @@ class Imaginary extends ProviderV2 {
|
|||
];
|
||||
}
|
||||
|
||||
$quality = $this->config->getAppValue('preview', 'jpeg_quality', '80');
|
||||
switch ($mimeType) {
|
||||
case 'jpeg':
|
||||
$quality = $this->config->getAppValue('preview', 'jpeg_quality', '80');
|
||||
break;
|
||||
case 'webp':
|
||||
$quality = $this->config->getAppValue('preview', 'webp_quality', '80');
|
||||
break;
|
||||
default:
|
||||
$quality = $this->config->getAppValue('preview', 'jpeg_quality', '80');
|
||||
}
|
||||
|
||||
$operations[] = [
|
||||
'operation' => ($crop ? 'smartcrop' : 'fit'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue