Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
661 aurelien 1
<?php
880 aurelien 2
/**
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
16
 *
17
 * in=utf8
18
 * out=utf8
19
 *
20
 */
903 aurelien 21
class ImageProvider extends Cel {
661 aurelien 22
 
23
	function getElement($uid){
24
 
25
		if(!isset($uid[0])) {
26
			return;
27
		}
28
 
29
		$id_image = $uid[0];
30
 
31
		$format = 'temp';
32
 
33
		if(isset($_GET['format'])) {
34
			$format = $_GET['format'];
35
		}
36
 
37
		if(isset($_GET['dimensions'])) {
38
			$dimensions = $_GET['dimensions'];
39
		} else {
1392 aurelien 40
			if(isset($this->config['cel']['format_'.$format])) {
41
				$dimensions = $this->config['cel']['format_'.$format];
661 aurelien 42
			}
43
		}
44
 
1392 aurelien 45
		$this->config['cel']['format_'.$format] = $dimensions;
661 aurelien 46
 
47
		$generateur_image = new ImageRecreation($this->config);
48
 
49
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
50
 
51
		if(!$infos_image) {
52
			header('HTTP/1.0 404 Not Found');
53
			exit;
54
		}
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
	}
67
 
68
}
903 aurelien 69
?>