Browse Source

Fix la non prise en compte des arguments fournis dans l'interface de configuration

master
bricebou 7 months ago
parent
commit
47e1ee00c2
  1. 24
      optimages_pipelines.php

24
optimages_pipelines.php

@ -42,35 +42,27 @@ function optimages_post_edition($flux) {
$optimizer_chain = (new OptimizerChain());
$jpegoptim = lire_config('optimages/jpegoptim_activer') ?? '';
$jpegoptim_opt = lire_config('optimages/jpegoptim_options') ?? '';
$jpegoptim_opt = explode(', ', lire_config('optimages/jpegoptim_options')) ?? [];
if ($jpegoptim === 'on') {
$optimizer_chain->addOptimizer(new Jpegoptim([
$jpegoptim_opt
]));
$optimizer_chain->addOptimizer(new Jpegoptim($jpegoptim_opt));
}
$pngquant = lire_config('optimages/pngquant_activer') ?? '';
$pngquant_opt = lire_config('optimages/pngquant_options') ?? '';
$pngquant_opt = explode(', ', lire_config('optimages/pngquant_options')) ?? [];
if ($pngquant === 'on') {
$optimizer_chain->addOptimizer(new Pngquant([
$pngquant_opt
]));
$optimizer_chain->addOptimizer(new Pngquant($pngquant_opt));
}
$optipng = lire_config('optimages/optipng_activer') ?? '';
$optipng_opt = lire_config('optimages/optipng_options') ?? '';
$optipng_opt = explode(', ', lire_config('optimages/optipng_options')) ?? [];
if ($optipng === 'on') {
$optimizer_chain->addOptimizer(new Optipng([
$optipng_opt
]));
$optimizer_chain->addOptimizer(new Optipng($optipng_opt));
}
$gifsicle = lire_config('optimages/gifsicle_activer') ?? '';
$gifsicle_opt = lire_config('optimages/gifsicle_options') ?? '';
$gifsicle_opt = explode(', ', lire_config('optimages/gifsicle_options')) ?? [];
if ($gifsicle === 'on') {
$optimizer_chain->addOptimizer(new Gifsicle([
$gifsicle_opt
]));
$optimizer_chain->addOptimizer(new Gifsicle($gifsicle_opt));
}
$optimizer_chain->optimize($fichier);

Loading…
Cancel
Save