public function getUrlImageFrom($idAdresse = 0, $format = 'mini', $sqlWhere = '')
    {
        $url="";
        $dateUpload = "";
        $idHistoriqueImage = "";
        $string = new stringObject();
        /* inutile a cause de l'url rewriting
		 switch($format)
		 {
		case 'mini':
		$chemin = $this->getUrlImage("mini");
		break;
		case 'moyen':
		$chemin = $this->getUrlImage("moyen");
		break;
		case 'grand':
		$chemin = $this->getUrlImage("grand");
		break;
		}
		*/
        $req = "SELECT hi1.idHistoriqueImage as idHistoriqueImage, hi1.dateUpload as dateUpload,ha1.idAdresse as idAdresse,ha1.numero as numero,

				r.nom as nomRue,
				sq.nom as nomSousQuartier,
				q.nom as nomQuartier,
				v.nom as nomVille,
				p.nom as nomPays,
				ha1.numero as numeroAdresse,
				ha1.idRue,
				r.prefixe as prefixeRue,
				IF (ha1.idSousQuartier != 0, ha1.idSousQuartier, r.idSousQuartier) AS idSousQuartier,
				IF (ha1.idQuartier != 0, ha1.idQuartier, sq.idQuartier) AS idQuartier,
				IF (ha1.idVille != 0, ha1.idVille, q.idVille) AS idVille,
				IF (ha1.idPays != 0, ha1.idPays, v.idPays) AS idPays

				FROM historiqueImage hi2, historiqueImage hi1
				RIGHT JOIN _adresseEvenement ae ON ae.idAdresse = '".$idAdresse."'
						RIGHT JOIN _evenementEvenement ee ON ee.idEvenement = ae.idEvenement
						RIGHT JOIN _evenementImage ei ON ei.idEvenement = ee.idEvenementAssocie
						RIGHT JOIN evenements he1 ON he1.idEvenement=ee.idEvenementAssocie
						RIGHT JOIN evenements he2 ON he2.idEvenement = he1.idEvenement
						RIGHT JOIN historiqueAdresse ha1 ON ha1.idAdresse = ae.idAdresse
						RIGHT JOIN historiqueAdresse ha2 ON ha2.idAdresse = ha1.idAdresse

						LEFT JOIN rue r         ON r.idRue = ha1.idRue
						LEFT JOIN sousQuartier sq   ON sq.idSousQuartier = IF(ha1.idRue='0' and ha1.idSousQuartier!='0' ,ha1.idSousQuartier ,r.idSousQuartier )
						LEFT JOIN quartier q        ON q.idQuartier = IF(ha1.idRue='0' and ha1.idSousQuartier='0' and ha1.idQuartier!='0' ,ha1.idQuartier ,sq.idQuartier )
						LEFT JOIN ville v       ON v.idVille = IF(ha1.idRue='0' and ha1.idSousQuartier='0' and ha1.idQuartier='0' and ha1.idVille!='0' ,ha1.idVille ,q.idVille )
						LEFT JOIN pays p        ON p.idPays = IF(ha1.idRue='0' and ha1.idSousQuartier='0' and ha1.idQuartier='0' and ha1.idVille='0' and ha1.idPays!='0' ,ha1.idPays ,v.idPays )

						WHERE hi2.idImage = hi1.idImage
						AND hi1.idImage = ei.idImage
						".$sqlWhere."
								GROUP BY hi1.idImage,he1.idEvenement,ha1.idAdresse, hi1.idHistoriqueImage, ha1.idHistoriqueAdresse
								HAVING hi1.idHistoriqueImage = max(hi2.idHistoriqueImage)
								AND ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)
								LIMIT 1";


        $res = $this->connexionBdd->requete($req);

        $url='';
        $dateUpload='';
        $idHistoriqueImage=0;

        if (mysql_num_rows($res)==1) {
            $fetchAdresse = mysql_fetch_assoc($res);
            //$url = $chemin.$fetchAdresse['dateUpload'].'/'.$fetchAdresse['idHistoriqueImage'].".jpg";
            $url = 'photos-'.$string->convertStringToUrlRewrite($this->getIntituleAdresse($fetchAdresse)).'-'.$fetchAdresse['dateUpload'].'-'.$fetchAdresse['idHistoriqueImage'].'-'.$format.'.jpg';
            $dateUpload = $fetchAdresse['dateUpload'];
            $idHistoriqueImage = $fetchAdresse['idHistoriqueImage'];
        }
        if ($url=='') {
            $url = $this->getUrlImage().'transparent.gif';
        }

        return array('url'=>$url,'dateUpload'=>$dateUpload,'idHistoriqueImage'=>$idHistoriqueImage);
    }