* @copyright 2010 Tela-Botanica * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL * @version SVN: * @link /doc/jrest/ */ Class ImageRDF extends DBAccessor { var $config; function ImageRDF($config) { $this->config=$config; } /** * Recherche des images associee au numero nomenclatural * @param numeric $uid [0] : numero nomenclatural obligatoire , $uid[1] (optionnel) : taille image : S , M, L (default) */ // TODO : recherche taxon ? function getElement($uid){ // Taille if (isset($uid[1])) { $taille = $uid[1]; // S , M ou L } else { $taille = 'L'; } $DB=$this->connectDB($this->config,'cel_db'); // Recherche de toutes les observations transmises du taxon pour lesquelles une photo est associee. $query = 'SELECT * FROM cel_inventory, cel_obs_images, cel_images '. ' WHERE cel_inventory.num_nom_sel = "'.mysql_escape_string($uid[0]).'"'. ' AND cel_obs_images.coi_ce_utilisateur = cel_inventory.identifiant '. ' AND cel_obs_images.coi_ce_observation = cel_inventory.ordre '. ' AND cel_inventory.transmission = 1 '. ' AND cel_images.ci_ce_utilisateur = cel_obs_images.coi_ce_utilisateur '. ' AND ci_id_image = cel_obs_images.coi_ce_image'; $result =& $DB->query($query); if (DB::isError($result)) { die($result->getMessage()); } $picture_path = $this->config['cel_db']['url_images']; // Formatage du xml $xml = ''."\n"; $xml .= 'fetchrow(DB_FETCHMODE_ASSOC)) { // Calcul du chemin sur le serveur en fonction de l'identifiant (id) $id = $picture['ci_id_image']; $id = sprintf('%09s', $id) ; $id = wordwrap($id, 3 , '_', true) ; $id_fichier = $id.".jpg" ; $niveauDossier = split("_", $id) ; $dossierNiveau1 = $niveauDossier[0] ; $dossierNiveau2 = $niveauDossier[1] ; $picture_path_with_level = $picture_path.'/'.$dossierNiveau1.'/'.$dossierNiveau2 ; $xml .= ' array( 'method' => 'GET', 'header' => "Content-type: application/x-www-form-urlencoded\r\n"))); $flux = @fopen($url, 'r', false, $contexte); $contenu = json_decode(stream_get_contents($flux)); fclose($flux); return $contenu; } } ?>