feat: Imaginary WebP support

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
pull/38032/head
JanisPlayer 3 years ago committed by John Molakvoæ
parent 12f57ada7d
commit 80abec668b
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
  1. 2
      lib/private/Preview/Generator.php
  2. 20
      lib/private/Preview/Imaginary.php

@ -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…
Cancel
Save