[SPIP] ~maj v3.0.14-->v3.0.17
[ptitvelo/web/www.git] / www / prive / formulaires / configurer_reducteur.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
8 * *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
12
13 if (!defined('_ECRIRE_INC_VERSION')) return;
14
15 function formulaires_configurer_reducteur_charger_dist(){
16 foreach(array(
17 "image_process",
18 "formats_graphiques",
19 "creer_preview",
20 "taille_preview",
21 ) as $m)
22 $valeurs[$m] = $GLOBALS['meta'][$m];
23
24 $valeurs['taille_preview'] = intval($valeurs['taille_preview']);
25 if ($valeurs['taille_preview']<10)
26 $valeurs['taille_preview'] = 120;
27 return $valeurs;
28 }
29
30
31 function formulaires_configurer_reducteur_traiter_dist(){
32 $res = array('editable'=>true);
33
34 if (is_array($image_process = _request('image_process_'))) {
35 $image_process = array_keys($image_process);
36 $image_process = reset($image_process);
37
38 // application du choix de vignette
39 if ($image_process) {
40 // mettre a jour les formats graphiques lisibles
41 switch ($image_process) {
42 case 'gd1':
43 case 'gd2':
44 $formats_graphiques = $GLOBALS['meta']['gd_formats_read'];
45 break;
46 case 'netpbm':
47 $formats_graphiques = $GLOBALS['meta']['netpbm_formats'];
48 break;
49 case 'convert':
50 case 'imagick':
51 $formats_graphiques = 'gif,jpg,png';
52 break;
53 default: #debug
54 $formats_graphiques = '';
55 $image_process = 'non';
56 break;
57 }
58 ecrire_meta('formats_graphiques', $formats_graphiques,'non');
59 ecrire_meta('image_process', $image_process,'non');
60 }
61 }
62
63 foreach(array(
64 "creer_preview",
65 ) as $m)
66 if (!is_null($v=_request($m)))
67 ecrire_meta($m, $v=='oui'?'oui':'non');
68 if (!is_null($v=_request('taille_preview')))
69 ecrire_meta("taille_preview", intval($v));
70
71 $res['message_ok'] = _T('config_info_enregistree');
72 return $res;
73 }
74
75 function url_vignette_choix($process){
76 switch ($process){
77 case 'gd2':
78 if (!function_exists("ImageCreateTrueColor"))
79 return '';
80 case 'gd1':
81 if (!function_exists('ImageGif')
82 AND !function_exists('ImageJpeg')
83 AND !function_exists('ImagePng'))
84 return '';
85 break;
86 case 'netpbm':
87 if (defined('_PNMSCALE_COMMAND') AND _PNMSCALE_COMMAND=='')
88 return '';
89 break;
90 case 'imagick':
91 if (!method_exists('Imagick','readImage'))
92 return '';
93 break;
94 case 'convert':
95 if (defined('_CONVERT_COMMAND') AND _CONVERT_COMMAND=='')
96 return '';
97 break;
98 }
99 return generer_url_action("tester", "arg=$process&time=".time());
100 }