Compare commits

...

3 Commits

  1. 4
      formulaires/configurer_optimages.php
  2. 24
      optimages_pipelines.php
  3. 2
      paquet.xml

4
formulaires/configurer_optimages.php

@ -90,7 +90,7 @@ function formulaires_configurer_optimages_saisies_dist(): array {
'label' => '<:optimages:configurer_pngquant_options_label:>',
'explication' => '<:optimages:configurer_pngquant_options_explication:>',
'afficher_si' => '@pngquant_activer@=="on"',
'defaut' => '\'--force\'',
'defaut' => '\'--quality=85\',\'--force\',\'--skip-if-larger\'',
]
],
[
@ -135,7 +135,7 @@ function formulaires_configurer_optimages_saisies_dist(): array {
'label' => '<:optimages:configurer_gifsicle_options_label:>',
'explication' => '<:optimages:configurer_gifsicle_options_explication:>',
'afficher_si' => '@gifsicle_activer@=="on"',
'defaut' => '\'-O3\'',
'defaut' => '\'-b\', \'-O3\'',
]
],
]

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);

2
paquet.xml

@ -1,7 +1,7 @@
<paquet
prefix="optimages"
categorie="multimedia"
version="0.1.2"
version="0.1.4"
etat="test"
compatibilite="[4.0.0;4.2.*]"
logo="optimages.svg"

Loading…
Cancel
Save