diff --git a/ecrire/config-fonctions.php3 b/ecrire/config-fonctions.php3 index c5e66a61d9d74c455525e93898e317e5e9794b0c..0fcbb2e282df691f9c09a59f939d049828d33a5f 100644 --- a/ecrire/config-fonctions.php3 +++ b/ecrire/config-fonctions.php3 @@ -85,6 +85,9 @@ else { case 'gd2': $formats_graphiques = lire_meta('gd_formats'); break; + case 'netpbm': + $formats_graphiques = 'jpg'; + break; case 'convert': $formats_graphiques = 'gif,jpg,png'; break; @@ -109,10 +112,16 @@ else { } } + afficher_choix_vignette($p = 'netpbm'); + $nb_process ++; + + if ($convert_command) { afficher_choix_vignette($p = 'convert'); $nb_process ++; } + + echo "</tr></table>\n"; diff --git a/ecrire/inc_logos.php3 b/ecrire/inc_logos.php3 index a4b96b052cada8d32192a0c69e7a66eaa51b0808..5ae33750f34030cd120f9120f02b5484b182788d 100644 --- a/ecrire/inc_logos.php3 +++ b/ecrire/inc_logos.php3 @@ -194,7 +194,7 @@ function image_ratio ($srcWidth, $srcHeight, $maxWidth, $maxHeight) { } function creer_vignette($image, $maxWidth, $maxHeight, $format, $destination, $process='AUTO', $force=false) { - global $convert_command; + global $convert_command, $djpeg_command, $cjpeg_command, $pnmscale_command; // ordre de preference des formats graphiques pour creer les vignettes // le premier format disponible, selon la methode demandee, est utilise @@ -257,7 +257,14 @@ function creer_vignette($image, $maxWidth, $maxHeight, $format, $destination, $p imagick_write($handle, $vignette); if (!@file_exists($vignette)) return; // echec imagick } - else + if ($process == "netpbm") { + if ($format == "jpg") { + $vignette = $destination.".".$format; + exec("$djpeg_command $image | $pnmscale_command -width $destWidth | $cjpeg_command -outfile $vignette"); + if (!@file_exists($vignette)) + return; // echec commande + } + } // gd ou gd2 if ($process == 'gd1' OR $process == 'gd2') { diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3 index 8f9c26d89c0f902171e1a3b6978d1ac8704676be..1677af81b56fc2b6c75fd3180ab9f3b9a7cda532 100644 --- a/ecrire/inc_version.php3 +++ b/ecrire/inc_version.php3 @@ -126,6 +126,10 @@ $type_urls = 'standard'; // le chemin complet '/bin/convert' (Linux) ou '/sw/bin/convert' (fink/Mac OS X) // Note : preferer GD2 ou le module php imagick s'ils sont disponibles $convert_command = 'convert'; +// creation des vignettes avec djpeg/pnmscale/cjpeg +$djpeg_command = 'djpeg'; +$cjpeg_command = 'cjpeg'; +$pnmscale_command = 'pnmscale'; // faut-il passer les connexions MySQL en mode debug ? $mysql_debug = false; diff --git a/spip_image.php3 b/spip_image.php3 index 8792888f27473e39a792b47c61fa807668cc687d..df8bd6bb54273e5cf26c20685e9cbd47df83ce6a 100644 --- a/spip_image.php3 +++ b/spip_image.php3 @@ -78,7 +78,7 @@ function tester_vignette ($test_vignette) { } // et maintenant envoyer la vignette de tests - if (ereg("^(gd1|gd2|imagick|convert)$", $test_vignette)) { + if (ereg("^(gd1|gd2|imagick|convert|netpbm)$", $test_vignette)) { include_ecrire('inc_logos.php3'); $taille_preview = lire_meta("taille_preview"); if ($taille_preview < 10) $taille_preview = 120;