Subversion Repositories eFlore/Applications.cel

Rev

Rev 661 | Rev 903 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
661 aurelien 1
<?php
880 aurelien 2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
661 aurelien 3
 
880 aurelien 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
 *
22
 */
23
class imageProvider extends Cel {
661 aurelien 24
 
25
	function getElement($uid){
26
 
27
		if(!isset($uid[0])) {
28
			return;
29
		}
30
 
31
		$id_image = $uid[0];
32
 
33
		$format = 'temp';
34
 
35
		if(isset($_GET['format'])) {
36
			$format = $_GET['format'];
37
		}
38
 
39
		if(isset($_GET['dimensions'])) {
40
			$dimensions = $_GET['dimensions'];
41
		} else {
42
			if(isset($this->config['cel_db']['format_'.$format])) {
43
				$dimensions = $this->config['cel_db']['format_'.$format];
44
			}
45
		}
46
 
47
		$this->config['cel_db']['format_'.$format] = $dimensions;
48
 
49
		$generateur_image = new ImageRecreation($this->config);
50
 
51
		$infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
52
 
53
		if(!$infos_image) {
54
			header('HTTP/1.0 404 Not Found');
55
			exit;
56
		}
57
 
58
		$image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
59
 
60
		header('Content-type: image/jpeg');
61
		imagejpeg($image_generee);
62
		exit;
63
 
64
	}
65
 
66
	private function estUneImageALaDemande() {
67
 
68
	}
69
 
70
}
71
 
72
?>