Subversion Repositories eFlore/Applications.cel

Rev

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