Subversion Repositories eFlore/Archives.chorologie

Rev

Rev 12 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 jpm 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
9 jpm 4
// | PHP version 4.3                                                                                    |
4 jpm 5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Cartographie.                                                                   |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
34 jp_milcent 24
// CVS : $Id: carto.php,v 1.4 2006-05-31 14:43:35 jp_milcent Exp $
4 jpm 25
/**
26
* Fournie une image cartographique.
27
*
28
* Fichier permettant de récupérer l'image d'une carte créer par la bibliothèque cartographique
29
* et de la faire passer dans les entête HTTP.
30
*
31
*@package Cartographie
32
//Auteur original :
33
*@author        Nicolas MATHIEU
34
//Autres auteurs :
35
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
36
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
37
*@copyright     Tela-Botanica 2000-2004
34 jp_milcent 38
*@version       $Revision: 1.4 $ $Date: 2006-05-31 14:43:35 $
4 jpm 39
// +------------------------------------------------------------------------------------------------------+
40
*/
41
 
42
// +------------------------------------------------------------------------------------------------------+
43
// |                                            ENTETE du PROGRAMME                                       |
44
// +------------------------------------------------------------------------------------------------------+
34 jp_milcent 45
session_name($_GET['session_name']);
46
session_id($_GET['session_id']);
12 jpm 47
session_start();
4 jpm 48
 
49
// +------------------------------------------------------------------------------------------------------+
50
// |                                            CORPS du PROGRAMME                                        |
51
// +------------------------------------------------------------------------------------------------------+
12 jpm 52
$image = imagecreatefrompng($_SESSION['chemin'].$_SESSION['fichier'].'.png');
53
if (!$image) {
34 jp_milcent 54
	echo '<pre>';
55
    echo session_name()."\n";
56
    echo session_id()."\n";
57
    echo $_SESSION['chemin'].$_SESSION['fichier'].'.png'."\n";
58
    echo '</pre>';
12 jpm 59
    trigger_error($image);
60
} else {
61
    header("Expires: Wen, 01 Dec 1999 01:00:00 GMT");// Date du passé
62
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");// toujours modifié
63
    header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
64
    header("Pragma: no-cache"); // HTTP/1.0
65
    header ("content-type:image/png");
66
    chmod($_SESSION['chemin'].$_SESSION['fichier'].'.png', 755);
67
    imagepng($image);
68
    unlink($_SESSION['chemin'].$_SESSION['fichier'].'.png');
69
    //Nous nettoyons le dossier tmp des fichiers qu'il contient:
70
    $poignet_de_dossier = opendir($_SESSION['chemin']);
71
    while ($fichier_dechet = readdir($poignet_de_dossier)) {
72
        if ($fichier_dechet != '.' && $fichier_dechet != '..') {
73
            unlink($_SESSION['chemin'].$fichier_dechet);
74
        }
4 jpm 75
    }
12 jpm 76
    closedir($poignet_de_dossier);
4 jpm 77
}
78
 
79
// +------------------------------------------------------------------------------------------------------+
80
// |                                            PIED du PROGRAMME                                         |
81
// +------------------------------------------------------------------------------------------------------+
82
exit();
83
 
84
/* +--Fin du code ----------------------------------------------------------------------------------------+
85
*
86
* $Log: not supported by cvs2svn $
34 jp_milcent 87
* Revision 1.3  2005/02/22 19:35:08  jpm
88
* Fin de gestion des variables via les sessions.
89
*
12 jpm 90
* Revision 1.2  2005/02/22 16:35:16  jpm
91
* Mise en forme.
92
* Utilisation de  constantes pour les chemins d'accès aux fichiers.
93
* Ajout de commentaires.
94
*
9 jpm 95
* Revision 1.1  2005/02/22 12:02:57  jpm
96
* Ajout des fichiers de la bibliothèque cartographique.
4 jpm 97
*
98
* +-- Fin du code ----------------------------------------------------------------------------------------+
99
*/
100
?>