Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 903 Rev 1392
1
<?php
1
<?php
2
/**
2
/**
3
* PHP Version 5
3
* PHP Version 5
4
*
4
*
5
* @category  PHP
5
* @category  PHP
6
* @package   papyrus_bp
6
* @package   papyrus_bp
7
* @author    aurelien <aurelien@tela-botanica.org>
7
* @author    aurelien <aurelien@tela-botanica.org>
8
* @copyright 2010 Tela-Botanica
8
* @copyright 2010 Tela-Botanica
9
* @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
10
* @version   SVN: <svn_id>
10
* @version   SVN: <svn_id>
11
* @link      /doc/papyrus_bp/
11
* @link      /doc/papyrus_bp/
12
*/
12
*/
13
 
13
 
14
/**
14
/**
15
 * 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
16
 * 
16
 * 
17
 * in=utf8
17
 * in=utf8
18
 * out=utf8
18
 * out=utf8
19
 * 
19
 * 
20
 */
20
 */
21
class ImageProvider extends Cel {
21
class ImageProvider extends Cel {
22
	
22
	
23
	function getElement($uid){
23
	function getElement($uid){
24
	
24
	
25
		if(!isset($uid[0])) {
25
		if(!isset($uid[0])) {
26
			return;
26
			return;
27
		}
27
		}
28
		
28
		
29
		$id_image = $uid[0];
29
		$id_image = $uid[0];
30
		
30
		
31
		$format = 'temp';
31
		$format = 'temp';
32
		
32
		
33
		if(isset($_GET['format'])) {
33
		if(isset($_GET['format'])) {
34
			$format = $_GET['format'];
34
			$format = $_GET['format'];
35
		}
35
		}
36
		
36
		
37
		if(isset($_GET['dimensions'])) {
37
		if(isset($_GET['dimensions'])) {
38
			$dimensions = $_GET['dimensions'];
38
			$dimensions = $_GET['dimensions'];
39
		} else {
39
		} else {
40
			if(isset($this->config['cel_db']['format_'.$format])) {
40
			if(isset($this->config['cel']['format_'.$format])) {
41
				$dimensions = $this->config['cel_db']['format_'.$format];
41
				$dimensions = $this->config['cel']['format_'.$format];
42
			}
42
			}
43
		}
43
		}
44
	
44
	
45
		$this->config['cel_db']['format_'.$format] = $dimensions;
45
		$this->config['cel']['format_'.$format] = $dimensions;
46
		
46
		
47
		$generateur_image = new ImageRecreation($this->config);
47
		$generateur_image = new ImageRecreation($this->config);
48
		
48
		
49
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
49
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
50
		
50
		
51
		if(!$infos_image) {
51
		if(!$infos_image) {
52
			header('HTTP/1.0 404 Not Found');
52
			header('HTTP/1.0 404 Not Found');
53
			exit;
53
			exit;
54
		}
54
		}
55
		
55
		
56
		$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
56
		$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
57
		
57
		
58
		header('Content-type: image/jpeg');
58
		header('Content-type: image/jpeg');
59
		imagejpeg($image_generee);
59
		imagejpeg($image_generee);
60
		exit; 
60
		exit; 
61
		
61
		
62
	}
62
	}
63
	
63
	
64
	private function estUneImageALaDemande() {
64
	private function estUneImageALaDemande() {
65
		
65
		
66
	}
66
	}
67
	
67
	
68
}
68
}
69
?>
69
?>