Subversion Repositories eFlore/Applications.cel

Rev

Rev 880 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 880 Rev 903
1
<?php
1
<?php
2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
-
 
3
 
-
 
4
/**
2
/**
5
* PHP Version 5
3
* PHP Version 5
6
*
4
*
7
* @category  PHP
5
* @category  PHP
8
* @package   papyrus_bp
6
* @package   papyrus_bp
9
* @author    aurelien <aurelien@tela-botanica.org>
7
* @author    aurelien <aurelien@tela-botanica.org>
10
* @copyright 2010 Tela-Botanica
8
* @copyright 2010 Tela-Botanica
11
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
* @version   SVN: <svn_id>
10
* @version   SVN: <svn_id>
13
* @link      /doc/papyrus_bp/
11
* @link      /doc/papyrus_bp/
14
*/
12
*/
15
 
13
 
16
/**
14
/**
17
 * Classe fournissant des images au format demandé ou bien aux dimensions demandées
15
 * Classe fournissant des images au format demandé ou bien aux dimensions demandées
18
 * 
16
 * 
19
 * in=utf8
17
 * in=utf8
20
 * out=utf8
18
 * out=utf8
21
 * 
19
 * 
22
 */
20
 */
23
class imageProvider extends Cel {
21
class ImageProvider extends Cel {
24
	
22
	
25
	function getElement($uid){
23
	function getElement($uid){
26
	
24
	
27
		if(!isset($uid[0])) {
25
		if(!isset($uid[0])) {
28
			return;
26
			return;
29
		}
27
		}
30
		
28
		
31
		$id_image = $uid[0];
29
		$id_image = $uid[0];
32
		
30
		
33
		$format = 'temp';
31
		$format = 'temp';
34
		
32
		
35
		if(isset($_GET['format'])) {
33
		if(isset($_GET['format'])) {
36
			$format = $_GET['format'];
34
			$format = $_GET['format'];
37
		}
35
		}
38
		
36
		
39
		if(isset($_GET['dimensions'])) {
37
		if(isset($_GET['dimensions'])) {
40
			$dimensions = $_GET['dimensions'];
38
			$dimensions = $_GET['dimensions'];
41
		} else {
39
		} else {
42
			if(isset($this->config['cel_db']['format_'.$format])) {
40
			if(isset($this->config['cel_db']['format_'.$format])) {
43
				$dimensions = $this->config['cel_db']['format_'.$format];
41
				$dimensions = $this->config['cel_db']['format_'.$format];
44
			}
42
			}
45
		}
43
		}
46
	
44
	
47
		$this->config['cel_db']['format_'.$format] = $dimensions;
45
		$this->config['cel_db']['format_'.$format] = $dimensions;
48
		
46
		
49
		$generateur_image = new ImageRecreation($this->config);
47
		$generateur_image = new ImageRecreation($this->config);
50
		
48
		
51
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
49
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
52
		
50
		
53
		if(!$infos_image) {
51
		if(!$infos_image) {
54
			header('HTTP/1.0 404 Not Found');
52
			header('HTTP/1.0 404 Not Found');
55
			exit;
53
			exit;
56
		}
54
		}
57
		
55
		
58
		$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
56
		$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
59
		
57
		
60
		header('Content-type: image/jpeg');
58
		header('Content-type: image/jpeg');
61
		imagejpeg($image_generee);
59
		imagejpeg($image_generee);
62
		exit; 
60
		exit; 
63
		
61
		
64
	}
62
	}
65
	
63
	
66
	private function estUneImageALaDemande() {
64
	private function estUneImageALaDemande() {
67
		
65
		
68
	}
66
	}
69
	
67
	
70
}
68
}
71
 
-
 
72
?>
69
?>
73
70