1014b73c1ecd42090e6b397b8ba4c8571f17dad9
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2017 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
14 * Formulaire de configuration pour choisir la librairie graphique
15 * et les tailles de redimensionnement des vignettes
17 * @package SPIP\Core\Formulaires
20 if (!defined('_ECRIRE_INC_VERSION')) {
25 * Chargement du formulaire de configuration de la librairie graphique
28 * Environnement du formulaire
30 function formulaires_configurer_reducteur_charger_dist() {
38 $valeurs[$m] = isset($GLOBALS['meta'][$m]) ?
$GLOBALS['meta'][$m] : null;
41 $valeurs['taille_preview'] = intval($valeurs['taille_preview']);
42 if ($valeurs['taille_preview'] < 10) {
43 $valeurs['taille_preview'] = 120;
51 * Traitements du formulaire de configuration de la librairie graphique
54 * Retours des traitements
56 function formulaires_configurer_reducteur_traiter_dist() {
57 $res = array('editable' => true);
59 if (is_array($image_process = _request('image_process_'))) {
60 $image_process = array_keys($image_process);
61 $image_process = reset($image_process);
63 // application du choix de vignette
65 // mettre a jour les formats graphiques lisibles
66 switch ($image_process) {
69 $formats_graphiques = $GLOBALS['meta']['gd_formats_read'];
72 $formats_graphiques = $GLOBALS['meta']['netpbm_formats'];
76 $formats_graphiques = 'gif,jpg,png';
79 $formats_graphiques = '';
80 $image_process = 'non';
83 ecrire_meta('formats_graphiques', $formats_graphiques, 'non');
84 ecrire_meta('image_process', $image_process, 'non');
91 if (!is_null($v = _request($m))) {
92 ecrire_meta($m, $v == 'oui' ?
'oui' : 'non');
95 if (!is_null($v = _request('taille_preview'))) {
96 ecrire_meta('taille_preview', intval($v));
99 $res['message_ok'] = _T('config_info_enregistree');
105 * Indique si une librairie graphique peut être utilisée et retourne alors
106 * une URL pour tester la librairie
108 * @param string $process
109 * Code de la libriairie, parmi gd2, gd1, netpbm, imagick ou convert
111 * URL d'action pour tester la librairie graphique en créant une vignette
113 function url_vignette_choix($process) {
116 if (!function_exists('ImageCreateTrueColor')) {
121 if (!function_exists('ImageGif')
122 and !function_exists('ImageJpeg')
123 and !function_exists('ImagePng')
129 if (defined('_PNMSCALE_COMMAND') and _PNMSCALE_COMMAND
== '') {
134 if (!method_exists('Imagick', 'readImage')) {
139 if (defined('_CONVERT_COMMAND') and _CONVERT_COMMAND
== '') {
145 return generer_url_action('tester', "arg=$process&time=" . time());