Subversion Repositories eFlore/Applications.cel

Rev

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

<?php
/**
* PHP Version 5
*
* @category  PHP
* @package   jrest
* @author    David Delon <david.delon@clapas.net>
* @copyright 2010 Tela-Botanica
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version   SVN: <svn_id>
* @link      /doc/jrest/
*/

/**
* NameImage.php  
* 
* in : utf8
* out : 8859
* 
* Cas d'utilisation :
* Service recherche d'image a partir d'un numero nomenclatural
* 
* 1: Le service recoit un numero nomenclatural
* 2: Le service calcul le numero taxonomique associe
* 3: Le service recherche une image disponible pour ce numero taxonomique
* 4: Le service redimensionne l'image et la renvoie
*/

/** Constante stockant l'URL de la page d'accueil de Photoflora.*/
define('EF_URL_PHOTOFLORA', 'http://photoflora.free.fr/');
/** Constante stockant l'URL de la page de Photoflora affichant toutes les images d'un taxon donné.*/
define('EF_URL_PHOTOFLORA_TAXON', EF_URL_PHOTOFLORA.'FiTax.php?NumTaxon=%s');
/** Constante stockant l'URL du dossier de photoflora contenant les images miniatures.*/
define('EF_URL_PHOTOFLORA_IMG_MIN', 'http://photoflora.free.fr/photos/%s/min/%s');
/** Constante stockant l'URL du service XML de Photoflora.*/
define('EF_URL_PHOTOFLORA_SERVICE', EF_URL_PHOTOFLORA.'ef_photoflora.php?nt=%s');

define('EF_URL_PHOTOFLORA_REGEXP_01', '/\/photos\/([^\/]+)\/max\/(.+)$/');
define('EF_URL_PHOTOFLORA_REGEXP_02', '/photoflora([^.]+)\.free\.fr\/max\/(.+)$/');

class NameImage extends Cel  {

        function getElement($uid){
                
                $image = array();
                
                if(isset($uid[0])) {
                        $url = 'http://photoflora.free.fr/eflore-photoflora/services/index.php/0.1/projets/photoflora/images?masque.nn='.$uid[0].'&navigation.limite=1';
                        $resultat = @file_get_contents($url);
                        $resultat = json_decode($resultat);
                        if(is_object($resultat) && isset($resultat->resultats)) {
                                $element = (array)$resultat->resultats;
                                $element = array_pop($element);
                                $image = array($element->{'binaire.href'}, $element->{'binaire.hrefmax'});
                        }
                }
                
                $this->envoyerJson($image);                     
                return true;    
        }
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.4  2008-11-13 11:29:12  ddelon
* Reecriture gwt-ext
*
* Revision 1.2  2008-01-30 08:57:28  ddelon
* fin mise en place mygwt
*
* Revision 1.1  2007-06-06 13:31:16  ddelon
* v0.09
* 
*/
?>