Subversion Repositories eFlore/Applications.cel

Rev

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

<?php
/**
* PHP Version 5
*
* @category  PHP
* @package   papyrus_bp
* @author    aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version   SVN: <svn_id>
* @link      /doc/papyrus_bp/
*/

/**
 * Classe fournissant des images au format demandé ou bien aux dimensions demandées
 * 
 * in=utf8
 * out=utf8
 * 
 */
class ImageProvider extends Cel {
        
        function getElement($uid){
        
                if(!isset($uid[0])) {
                        return;
                }
                
                $id_image = $uid[0];
                
                $format = 'temp';
                
                if(isset($_GET['format'])) {
                        $format = $_GET['format'];
                }
                
                if(isset($_GET['dimensions'])) {
                        $dimensions = $_GET['dimensions'];
                } else {
                        if(isset($this->config['cel']['format_'.$format])) {
                                $dimensions = $this->config['cel']['format_'.$format];
                        }
                }
        
                $this->config['cel']['format_'.$format] = $dimensions;
                
                $generateur_image = new ImageRecreation($this->config);
                
                $infos_image = $generateur_image->obtenirImageEtInfosPourId($id_image);
                
                if(!$infos_image) {
                        header('HTTP/1.0 404 Not Found');
                        exit;
                }
                
                $image_generee = $generateur_image->creerMiniatureImageSelonFormat($infos_image, $format);
                
                header('Content-type: image/jpeg');
                imagejpeg($image_generee);
                exit; 
                
        }
        
        private function estUneImageALaDemande() {
                
        }
        
}
?>