fixes #2118 add config setting animated_webp_compression_quality (default=70)

This commit is contained in:
plegall 2024-02-19 17:17:28 +01:00
parent 4adf36f2e5
commit 1000ae868e
2 changed files with 7 additions and 1 deletions

View file

@ -638,12 +638,14 @@ class image_ext_imagick implements imageInterface
function set_compression_quality($quality) function set_compression_quality($quality)
{ {
global $conf;
if ($this->is_animated_webp) if ($this->is_animated_webp)
{ {
// in cas of animated WebP, we need to maximize quality to 70 to avoid // in cas of animated WebP, we need to maximize quality to 70 to avoid
// heavy thumbnails (or square or whatever is displayed on the thumbnails // heavy thumbnails (or square or whatever is displayed on the thumbnails
// page) // page)
$quality = min($quality, 70); $quality = min($quality, $conf['animated_webp_compression_quality']);
} }
$this->add_command('quality', $quality); $this->add_command('quality', $quality);

View file

@ -925,6 +925,10 @@ $conf['derivative_default_size'] = 'medium';
// EXIF/IPTC... from derivative? // EXIF/IPTC... from derivative?
$conf['derivatives_strip_metadata_threshold'] = 256000; $conf['derivatives_strip_metadata_threshold'] = 256000;
// For animated webP files, to avoid heavy derivatives, set a specific quality,
// different from derivatives.resize_quality
$conf['animated_webp_compression_quality'] = 70;
//Maximum Ajax requests at once, for thumbnails on-the-fly generation //Maximum Ajax requests at once, for thumbnails on-the-fly generation
$conf['max_requests']=3; $conf['max_requests']=3;