diff --git a/lib/Helper.php b/lib/Helper.php index fb0d433..135f543 100644 --- a/lib/Helper.php +++ b/lib/Helper.php @@ -5,6 +5,7 @@ use rex; use rex_version; use Imagick; +use rex_config; class Helper { @@ -30,8 +31,9 @@ public static function getOutputFormat($requestedTypes): string } } - // check if avif output is possible - if (in_array('image/avif', $requestedTypes)) { + // check if avif output is possible and not deactivated + $disable_avif = rex_config::get("media_negotiator", "disable_avif", false); + if (in_array('image/avif', $requestedTypes) && !$disable_avif) { // check if redaxo version >= 5.15.0 (media_manager supports avif from this version upwards, must be true for MM and Imagick) // and if either imageavif() is available or Imagick installed diff --git a/package.yml b/package.yml index 0a73f83..f9dffd2 100644 --- a/package.yml +++ b/package.yml @@ -15,6 +15,7 @@ page: default_config: force_imagick: false + disable_avif: false requires: redaxo: ^5.13.0 diff --git a/pages/config.php b/pages/config.php index 6304e0f..0d06df2 100644 --- a/pages/config.php +++ b/pages/config.php @@ -10,6 +10,12 @@ $field->addOption('Ja', true); $field->addOption('Nein', false); +$field = $form->addRadioField('disable_avif'); +$field->setLabel("AVIF deaktivieren."); +$field->setNotice("Wenn der Server über keinen AVIF Codec verfügt kann die AVIF Generierung hier deaktiviert werden."); +$field->addOption('Ja', true); +$field->addOption('Nein', false); + $fragment = new rex_fragment(); $fragment->setVar('class', 'edit', false);