+ ecrire_meta("gd_formats_read", $gd_formats . $gd_formats_read_gif);
+ ecrire_meta("gd_formats", $gd_formats);
+ } // verifier les formats netpbm
+ else {
+ if ($arg == "netpbm") {
+ if (!defined('_PNMSCALE_COMMAND')) {
+ define('_PNMSCALE_COMMAND', 'pnmscale');
+ } // Securite : mes_options.php peut preciser le chemin absolu
+ if (_PNMSCALE_COMMAND == '') {
+ return;
+ }
+ $netpbm_formats = array();
+
+ $jpegtopnm_command = str_replace("pnmscale",
+ "jpegtopnm", _PNMSCALE_COMMAND);
+ $pnmtojpeg_command = str_replace("pnmscale",
+ "pnmtojpeg", _PNMSCALE_COMMAND);
+
+ $vignette = _ROOT_IMG_PACK . "test.jpg";
+ $dest = _DIR_VAR . "test-jpg.jpg";
+ $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
+ spip_log($commande);
+ exec($commande);
+ if ($taille = @getimagesize($dest)) {
+ if ($taille[1] == 10) {
+ $netpbm_formats[] = "jpg";
+ }
+ }
+ $giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND);
+ $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND);
+ $vignette = _ROOT_IMG_PACK . "test.gif";
+ $dest = _DIR_VAR . "test-gif.jpg";
+ $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
+ spip_log($commande);
+ exec($commande);
+ if ($taille = @getimagesize($dest)) {
+ if ($taille[1] == 10) {
+ $netpbm_formats[] = "gif";
+ }
+ }