Subversion Repositories eFlore/Applications.cel

Rev

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

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