Subversion Repositories eFlore/Applications.cel

Rev

Rev 1392 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1392 Rev 2458
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// declare(encoding='UTF-8');
2
/**
3
/**
3
* PHP Version 5
4
 * Service fournissant des images au format demandé ou bien aux dimensions demandées.
4
*
5
 *
-
 
6
 * @internal   Mininum PHP version : 5.2
5
* @category  PHP
7
 * @category   CEL
6
* @package   papyrus_bp
8
 * @package    Services
-
 
9
 * @subpackage Images
-
 
10
 * @version    0.1
7
* @author    aurelien <aurelien@tela-botanica.org>
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
8
* @copyright 2010 Tela-Botanica
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
10
* @version   SVN: <svn_id>
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
11
* @link      /doc/papyrus_bp/
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
12
*/
-
 
13
 
-
 
14
/**
-
 
15
 * Classe fournissant des images au format demandé ou bien aux dimensions demandées
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
16
 * 
-
 
17
 * in=utf8
-
 
18
 * out=utf8
-
 
19
 * 
-
 
20
 */
17
 */
21
class ImageProvider extends Cel {
18
class ImageProvider extends Cel {
22
	
19
 
23
	function getElement($uid){
20
	public function getElement($uid){
24
	
-
 
25
		if(!isset($uid[0])) {
21
		if (!isset($uid[0])) {
26
			return;
22
			return;
27
		}
23
		}
28
		
-
 
29
		$id_image = $uid[0];
24
		$id_image = $uid[0];
30
		
25
 
31
		$format = 'temp';
26
		$format = 'temp';
32
		
-
 
33
		if(isset($_GET['format'])) {
27
		if (isset($_GET['format'])) {
34
			$format = $_GET['format'];
28
			$format = $_GET['format'];
35
		}
29
		}
36
		
30
 
37
		if(isset($_GET['dimensions'])) {
31
		if (isset($_GET['dimensions'])) {
38
			$dimensions = $_GET['dimensions'];
32
			$dimensions = $_GET['dimensions'];
39
		} else {
-
 
40
			if(isset($this->config['cel']['format_'.$format])) {
33
		} else if (isset($this->config['cel']['format_'.$format])) {
41
				$dimensions = $this->config['cel']['format_'.$format];
34
			$dimensions = $this->config['cel']['format_'.$format];
42
			}
-
 
43
		}
35
		}
44
	
-
 
45
		$this->config['cel']['format_'.$format] = $dimensions;
36
		$this->config['cel']['format_'.$format] = $dimensions;
46
		
37
 
47
		$generateur_image = new ImageRecreation($this->config);
38
		$generateur_image = new ImageRecreation($this->config);
48
		
-
 
49
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
39
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
50
		
-
 
51
		if(!$infos_image) {
40
		if (!$infos_image) {
52
			header('HTTP/1.0 404 Not Found');
41
			header('HTTP/1.0 404 Not Found');
53
			exit;
42
			exit();
-
 
43
		} else {
-
 
44
			$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
-
 
45
			header('Content-type: image/jpeg');
-
 
46
			imagejpeg($image_generee);
-
 
47
			exit();
54
		}
48
		}
55
		
-
 
56
		$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
-
 
57
		
-
 
58
		header('Content-type: image/jpeg');
-
 
59
		imagejpeg($image_generee);
-
 
60
		exit; 
-
 
61
		
-
 
62
	}
-
 
63
	
-
 
64
	private function estUneImageALaDemande() {
-
 
65
		
-
 
66
	}
49
	}
67
	
-
 
68
}
-
 
69
?>
-
 
70
50
}
-
 
51
71
52