Subversion Repositories eFlore/Applications.cel

Rev

Rev 1426 | Rev 1527 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1426 Rev 1468
1
<?php
1
<?php
2
/**
2
/**
3
* PHP Version 5
3
* PHP Version 5
4
*
4
*
5
* @category  PHP
5
* @category  PHP
6
* @package   jrest
6
* @package   jrest
7
* @author    David Delon <david.delon@clapas.net>
7
* @author    David Delon <david.delon@clapas.net>
8
* @copyright 2010 Tela-Botanica
8
* @copyright 2010 Tela-Botanica
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
* @version   SVN: <svn_id>
10
* @version   SVN: <svn_id>
11
* @link      /doc/jrest/
11
* @link      /doc/jrest/
12
*/
12
*/
13
 
13
 
14
/**
14
/**
15
* NameImage.php  
15
* NameImage.php  
16
* 
16
* 
17
* in : utf8
17
* in : utf8
18
* out : 8859
18
* out : 8859
19
* 
19
* 
20
* Cas d'utilisation :
20
* Cas d'utilisation :
21
* Service recherche d'image a partir d'un numero nomenclatural
21
* Service recherche d'image a partir d'un numero nomenclatural
22
* 
22
* 
23
* 1: Le service recoit un numero nomenclatural
23
* 1: Le service recoit un numero nomenclatural
24
* 2: Le service calcul le numero taxonomique associe
24
* 2: Le service calcul le numero taxonomique associe
25
* 3: Le service recherche une image disponible pour ce numero taxonomique
25
* 3: Le service recherche une image disponible pour ce numero taxonomique
26
* 4: Le service redimensionne l'image et la renvoie
26
* 4: Le service redimensionne l'image et la renvoie
27
*/
27
*/
28
 
-
 
29
/** Constante stockant l'URL de la page d'accueil de Photoflora.*/
-
 
30
define('EF_URL_PHOTOFLORA', 'http://photoflora.free.fr/');
-
 
31
/** Constante stockant l'URL de la page de Photoflora affichant toutes les images d'un taxon donné.*/
-
 
32
define('EF_URL_PHOTOFLORA_TAXON', EF_URL_PHOTOFLORA.'FiTax.php?NumTaxon=%s');
-
 
33
/** Constante stockant l'URL du dossier de photoflora contenant les images miniatures.*/
-
 
34
define('EF_URL_PHOTOFLORA_IMG_MIN', 'http://photoflora.free.fr/photos/%s/min/%s');
-
 
35
/** Constante stockant l'URL du service XML de Photoflora.*/
-
 
36
define('EF_URL_PHOTOFLORA_SERVICE', EF_URL_PHOTOFLORA.'ef_photoflora.php?nt=%s');
-
 
37
 
-
 
38
define('EF_URL_PHOTOFLORA_REGEXP_01', '/\/photos\/([^\/]+)\/max\/(.+)$/');
-
 
39
define('EF_URL_PHOTOFLORA_REGEXP_02', '/photoflora([^.]+)\.free\.fr\/max\/(.+)$/');
-
 
40
 
28
 
41
class NameImage extends Cel  {
29
class NameImage extends Cel  {
42
 
30
 
43
	function getElement($uid){
31
	function getElement($uid){
44
		
32
		
45
		$image = array();
33
		$image = array();
-
 
34
		$url_photoflora = $this->config['eflore']['url_service_photoflora'];
46
		
35
		
47
		if(isset($uid[0])) {
36
		if(isset($uid[0])) {
48
			$url = 'http://photoflora.free.fr/eflore-photoflora/services/index.php/0.1/projets/photoflora/images?masque.nn='.$uid[0].'&navigation.limite=1';
37
			$url = $url_photoflora.'?masque.nn='.$uid[0].'&navigation.limite=1';
49
			$resultat = @file_get_contents($url);
38
			$resultat = @file_get_contents($url);
50
			$resultat = json_decode($resultat);
39
			$resultat = json_decode($resultat);
51
			if(is_object($resultat) && isset($resultat->resultats)) {
40
			if(is_object($resultat) && isset($resultat->resultats)) {
52
				$element = (array)$resultat->resultats;
41
				$element = (array)$resultat->resultats;
53
				$element = array_pop($element);
42
				$element = array_pop($element);
54
				$image = array($element->{'binaire.href'}, $element->{'binaire.hrefmax'});
43
				$image = array($element->{'binaire.href'}, $element->{'binaire.hrefmax'});
55
			}
44
			}
56
		}
45
		}
57
		
46
		
58
		$this->envoyerJson($image);			
47
		$this->envoyerJson($image);			
59
		return true;	
48
		return true;	
60
	}
49
	}
61
}
50
}
62
/* +--Fin du code ---------------------------------------------------------------------------------------+
51
/* +--Fin du code ---------------------------------------------------------------------------------------+
63
* $Log$
52
* $Log$
64
* Revision 1.4  2008-11-13 11:29:12  ddelon
53
* Revision 1.4  2008-11-13 11:29:12  ddelon
65
* Reecriture gwt-ext
54
* Reecriture gwt-ext
66
*
55
*
67
* Revision 1.2  2008-01-30 08:57:28  ddelon
56
* Revision 1.2  2008-01-30 08:57:28  ddelon
68
* fin mise en place mygwt
57
* fin mise en place mygwt
69
*
58
*
70
* Revision 1.1  2007-06-06 13:31:16  ddelon
59
* Revision 1.1  2007-06-06 13:31:16  ddelon
71
* v0.09
60
* v0.09
72
* 
61
* 
73
*/
62
*/
74
?>
63
?>