Skip to content

Commit

Permalink
add option to disable avif generation
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiLeni committed Oct 14, 2023
1 parent e8e3f85 commit c46483f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use rex;
use rex_version;
use Imagick;
use rex_config;

class Helper
{
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ page:

default_config:
force_imagick: false
disable_avif: false

requires:
redaxo: ^5.13.0
Expand Down
6 changes: 6 additions & 0 deletions pages/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c46483f

Please sign in to comment.