public function afficher($idImage = 0)
 {
     $t = new Template('modules/archi/templates/');
     $t->set_filenames(array('detailImage' => 'detailImage.tpl'));
     $adresse = new archiAdresse();
     $evenement = new archiEvenement();
     $authentification = new archiAuthentification();
     $string = new stringObject();
     $u = new archiUtilisateur();
     $d = new droitsObject();
     $html = "";
     if ((isset($this->variablesGet['formatPhoto']) && $this->variablesGet['formatPhoto'] == 'moyenRedim' || isset($this->variablesGet['formatPhoto']) && $this->variablesGet['formatPhoto'] == 'original') && !$authentification->estConnecte()) {
         // il faut etre connecté et donc inscrit pour pouvoir voir les images dans un format different
         $html .= $authentification->afficheFormulaireAuthentification('noCompact', array("msg" => "<b>Pour voir les photos au format moyen ou l'original vous devez être connecté. Si vous n'avez pas encore de compte utilisateur pour vous connecter,  cliquez <a href='" . $this->creerUrl('', 'inscription') . "'>ici</a></b>"));
     } else {
         if ($authentification->estConnecte()) {
             $t->assign_block_vars("isConnected", array());
             $idProfilUtilisateur = $u->getIdProfilFromUtilisateur($authentification->getIdUtilisateur());
             if ($d->isAuthorized('image_supprimer', $idProfilUtilisateur)) {
                 require_once __DIR__ . '/archiPersonne.class.php';
                 $e = new ArchiEvenement();
                 // on verifie que l'utilisateur est moderateur de la ville ou est admin
                 if ($u->isModerateurFromVille($authentification->getIdUtilisateur(), $idImage, 'idImage') || $idProfilUtilisateur == '4' || ArchiPersonne::isPerson($e->getIdEvenementGroupeAdresseFromIdEvenement($_GET['archiRetourIdValue']))) {
                     if (isset($this->variablesGet['archiRetourAffichage'])) {
                         $t->assign_block_vars('isAdminOrModerateurFromVille', array('urlSupprimerImage' => $this->creerUrl('deleteImage', '', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue']))));
                     } else {
                         $t->assign_block_vars('isAdminOrModerateurFromVille', array('urlSupprimerImage' => $this->creerUrl('deleteImage', '', array('archiIdImage' => $idImage))));
                     }
                 }
             }
             if ($authentification->estAdmin()) {
                 if (isset($this->variablesGet['archiRetourAffichage']) && isset($this->variablesGet['archiRetourIdName']) && isset($this->variablesGet['archiRetourIdValue'])) {
                     $t->assign_block_vars('isAdmin', array('urlAfficheHistorique' => $this->creerUrl('', 'afficheHistoriqueImage', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue']))));
                 } else {
                     $t->assign_block_vars('isAdmin', array('urlAfficheHistorique' => $this->creerUrl('', 'afficheHistoriqueImage', array('archiIdImage' => $idImage))));
                 }
             }
         }
         // gestion des liens vers le detail de la photo et autres formats
         if (isset($this->variablesGet["formatPhoto"])) {
             switch ($this->variablesGet["formatPhoto"]) {
                 case 'petit':
                     $classLienPetit = "formatAffichePhotoSelected";
                     $classLienMoyen = "formatAffichePhoto";
                     $classLienOriginal = "formatAffichePhoto";
                     $formatPhoto = "grand";
                     // petit correspond au format 'grand' en interne
                     $formatPhotoUrl = "petit";
                     break;
                 case 'moyenRedim':
                     $classLienPetit = "formatAffichePhoto";
                     $classLienMoyen = "formatAffichePhotoSelected";
                     $classLienOriginal = "formatAffichePhoto";
                     $formatPhoto = "moyenRedim";
                     $formatPhotoUrl = "moyenRedim";
                     break;
                 case 'original':
                     $classLienPetit = "formatAffichePhoto";
                     $classLienMoyen = "formatAffichePhoto";
                     $classLienOriginal = "formatAffichePhotoSelected";
                     $formatPhoto = "originaux";
                     $formatPhotoUrl = "original";
                     break;
             }
         } else {
             $classLienPetit = "formatAffichePhotoSelected";
             $classLienMoyen = "formatAffichePhoto";
             $classLienOriginal = "formatAffichePhoto";
             $formatPhoto = "grand";
             $formatPhotoUrl = "petit";
         }
         if (isset($this->variablesGet['archiRetourAffichage'])) {
             $t->assign_vars(array("choixFormatPhoto" => "<span style='color:#007799;'>Photo au format : <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => $this->variablesGet['archiRetourAffichage'], "archiRetourIdName" => $this->variablesGet['archiRetourIdName'], "archiRetourIdValue" => $this->variablesGet['archiRetourIdValue'], "formatPhoto" => 'petit')) . "' class='{$classLienPetit}'>Petit</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => $this->variablesGet['archiRetourAffichage'], "archiRetourIdName" => $this->variablesGet['archiRetourIdName'], "archiRetourIdValue" => $this->variablesGet['archiRetourIdValue'], "formatPhoto" => 'moyenRedim')) . "' class='{$classLienMoyen}'>Moyen</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => $this->variablesGet['archiRetourAffichage'], "archiRetourIdName" => $this->variablesGet['archiRetourIdName'], "archiRetourIdValue" => $this->variablesGet['archiRetourIdValue'], "formatPhoto" => 'original')) . "' class='{$classLienOriginal}'>Original</a></span><br />"));
         } else {
             $idAdresseRetour = $this->getIdAdresseFromIdImage($idImage);
             $t->assign_vars(array("choixFormatPhoto" => "<span style='color:#007799;'>Photo au format : <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => 'adresseDetail', "archiRetourIdName" => 'archiIdAdresse', "archiRetourIdValue" => $idAdresseRetour, "formatPhoto" => 'petit')) . "' class='{$classLienPetit}'>Petit</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => 'adresseDetail', "archiRetourIdName" => 'archiIdAdresse', "archiRetourIdValue" => $idAdresseRetour, "formatPhoto" => 'moyenRedim')) . "' class='{$classLienMoyen}'>Moyen</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => 'adresseDetail', "archiRetourIdName" => 'archiIdAdresse', "archiRetourIdValue" => $idAdresseRetour, "formatPhoto" => 'original')) . "' class='{$classLienOriginal}'>Original</a></span><br />"));
         }
         // ***********************************************************************************************************************
         // on prend l'adresse de reference de la page si elle existe sinon celle de l'evenement courant et sinon on prend l'adresse de reference de l'image
         if (isset($this->variablesGet['archiIdAdresse'])) {
             $idAdresseReference = $this->variablesGet['archiIdAdresse'];
         } elseif (isset($this->variablesGet['archiRetourIdName']) && $this->variablesGet['archiRetourIdName'] == 'idEvenement' && isset($this->variablesGet['archiRetourIdValue'])) {
             $idAdresseReference = $adresse->getIdAdresseFromIdEvenementGroupeAdresse($this->variablesGet['archiRetourIdValue']);
         } else {
             $idAdresseReference = $this->getIdAdresseFromIdImage($idImage);
         }
         // **********************************************************************************************************************
         $arrayInfosImage = $this->getInfosCompletesFromIdImage($idImage, array('idAdresseReference' => $idAdresseReference, 'displayFirstTitreAdresse' => true, 'classCSSTitreAdresse' => "textePrisDepuisVueSur", 'withZonesOnMouseOver' => true));
         if (count($arrayInfosImage['vueSurLiens']) > 0) {
             if (count($arrayInfosImage['vueSurLiens']) > 1) {
                 $t->assign_vars(array("infosVueSur" => "<span class='textePrisDepuisVueSurEntete'>Vue sur :</span>&nbsp;<br>" . implode("<br>", $arrayInfosImage['vueSurLiens']) . "<br>"));
             } else {
                 $t->assign_vars(array("infosVueSur" => "<span class='textePrisDepuisVueSurEntete'>Vue sur </span>&nbsp;" . implode(" / ", $arrayInfosImage['vueSurLiens']) . "<br>"));
             }
         }
         if (count($arrayInfosImage['prisDepuisLiens']) > 0) {
             $t->assign_vars(array("infosPrisDepuis" => "<br><span class='textePrisDepuisVueSurEntete'>Pris depuis</span>&nbsp; " . implode(" / ", $arrayInfosImage['prisDepuisLiens']) . "<br>"));
         }
         $e = new archiEvenement();
         if (archiPersonne::isPerson($e->getIdEvenementGroupeAdresseFromIdEvenement($_GET["archiRetourIdValue"]))) {
             $resImage = $this->connexionBdd->requete("SELECT * FROM `historiqueImage` WHERE `idImage` =" . $idImage . ' ORDER BY idHistoriqueImage DESC');
         } else {
             $resImage = $this->connexionBdd->requete("SELECT * FROM `historiqueImage` WHERE `idImage` = {$idImage}\n                    ORDER BY idHistoriqueImage DESC");
             /*$resImage = $this->connexionBdd->requete("
                             select hI.idSource,  hI.nom, hI.dateUpload, hI.dateCliche, hI.description, hI.idUtilisateur, hI.idHistoriqueImage, ha1.idAdresse as idAdresse, ha1.numero as numero,
                             hI.isDateClicheEnviron as isDateClicheEnviron,
                             r.nom as nomRue,
                             sq.nom as nomSousQuartier,
                             q.nom as nomQuartier,
                             v.nom as nomVille,
                             p.nom as nomPays,
                             ha1.numero as numeroAdresse,
                             hI.numeroArchive as numeroArchive,
                             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 hI
             
                             RIGHT JOIN _evenementImage ei ON ei.idImage = hI.idImage
                             RIGHT JOIN _evenementEvenement ee ON ee.idEvenementAssocie = ei.idEvenement
                             RIGHT JOIN _adresseEvenement ae ON ae.idEvenement = ee.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 hI.idImage='$idImage'
                             and hI2.idImage=hI.idImage
                             group by hI.idImage, hI.idHistoriqueImage, ha1.idAdresse,  ha1.idHistoriqueAdresse
                             having hI.idHistoriqueImage = max(hI2.idHistoriqueImage) and ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)
                             LIMIT 1
                             ");*/
         }
         $fetch = mysql_fetch_array($resImage);
         /*
         stripslashes($fetch['nom'])
          $this->date->toFrench($fetch['dateCliche'])
         */
         $nomEtDateCliche = "";
         if (stripslashes($fetch['nom']) != '' && $this->date->toFrench($fetch['dateCliche']) != '') {
             $nomEtDateCliche = stripslashes($fetch['nom']) . ' - ' . $this->date->toFrench($fetch['dateCliche']);
         } else {
             $nomEtDateCLiche = stripslashes($fetch['nom']) . $this->date->toFrench($fetch['dateCliche']);
         }
         // on affiche les deux car on sait qu'il y en a un qui est vide,  donc pas de probleme
         $datePriseDeVue = "";
         if ($this->date->toFrench($fetch['dateCliche']) != '') {
             $environ = "";
             if ($fetch['isDateClicheEnviron'] == '1') {
                 $environ = "environ ";
             }
             $datePriseDeVue = "Date : {$environ}" . $this->date->toFrench($fetch['dateCliche']);
         }
         $description = $fetch['description'];
         $bbCode = new bbCodeObject();
         //$bbCode = new bbCodeObject();
         if (!empty($description)) {
             $description = $bbCode->convertToDisplay(array('text' => $description));
         }
         if (isset($fetch['idSource']) && $fetch['idSource'] != '' && $fetch['idSource'] != '0') {
             $reqSource = "\n                    SELECT s.idSource as idSource,  s.nom as nomSource,  ts.nom as nomTypeSource\n                    FROM source s\n                    LEFT JOIN typeSource ts ON ts.idTypeSource = s.idTypeSource\n                    WHERE s.idSource = '" . $fetch['idSource'] . "'";
             $resSource = $this->connexionBdd->requete($reqSource);
             $fetchSource = mysql_fetch_assoc($resSource);
             $description .= "<br>Source : <a href='" . $this->creerUrl('', 'listeAdressesFromSource', array('source' => $fetch['idSource'], 'submit' => 'Rechercher')) . "'>" . stripslashes($fetchSource['nomSource']) . " (" . stripslashes($fetchSource['nomTypeSource']) . ")</a>";
         }
         if (isset($fetch['numeroArchive']) && $fetch['numeroArchive'] != '') {
             // modif fabien du 15/04/2011 suite mail directrice Archives de Strasbourg Mme Perry Laurence
             $description .= "<br>Cote Archives de Strasbourg : " . $fetch['numeroArchive'];
         }
         $intituleAdresse = $adresse->getIntituleAdresse($fetch);
         $reqImages = "\n            SELECT idImage FROM _evenementImage WHERE idEvenement = " . mysql_real_escape_string($_GET['archiRetourIdValue']) . " ORDER BY position\n            ";
         $resImages = $this->connexionBdd->requete($reqImages);
         $found = false;
         while ($row = mysql_fetch_assoc($resImages)) {
             if (intval($row['idImage']) == $_GET['archiIdImage']) {
                 if (isset($prev)) {
                     $prevImage = $prev;
                     $t->assign_block_vars('previous', array());
                 }
                 $next = true;
             } else {
                 if (isset($next)) {
                     $nextImage = $row;
                     $t->assign_block_vars('next', array());
                     break;
                 }
             }
             $prev = $row;
         }
         $reqImages = "\n            SELECT idImage FROM _evenementImage  WHERE idEvenement = " . mysql_real_escape_string($_GET['archiRetourIdValue']) . " ORDER BY position\n            ";
         $resImages = $this->connexionBdd->requete($reqImages);
         $imgList = array();
         while ($row = mysql_fetch_row($resImages)) {
             $reqImage = '
             SELECT idHistoriqueImage, dateUpload, description, idImage
             FROM historiqueImage
             WHERE idImage = ' . mysql_real_escape_string($row[0]) . '
             ORDER BY idHistoriqueImage DESC
             LIMIT 1';
             $resImage = $this->connexionBdd->requete($reqImage);
             $imgList[] = mysql_fetch_row($resImage);
         }
         $intituleAdresseNoQuartierNoVille = $adresse->getIntituleAdresse($fetch, array('noQuartier' => true, 'noSousQuartier' => true, 'noVille' => true));
         $format = isset($_GET['formatPhoto']) ? $_GET['formatPhoto'] : 'petit';
         if ($u->canModifyTags(array('idUtilisateur' => $authentification->getIdUtilisateur()))) {
             $tags = 'Tags&nbsp;: ';
             if (empty($fetch["tags"])) {
                 $tags .= '<i>(aucun)</i>';
             } else {
                 $tags .= stripslashes($fetch["tags"]);
             }
         } else {
             $tags = '';
         }
         $t->assign_vars(array('datePriseDeVue' => $datePriseDeVue, 'cheminDetailImage' => 'photos-' . $string->convertStringToUrlRewrite($intituleAdresse) . '-' . $fetch['dateUpload'] . '-' . $fetch['idHistoriqueImage'] . '-' . $formatPhoto . '.jpg', 'nomEtDateCliche' => $nomEtDateCliche, 'tags' => $tags, 'description' => $description, 'fullscreenDesc' => strip_tags($description), 'nom' => $intituleAdresseNoQuartierNoVille, 'IDDivImage' => "divImage_" . $idImage, 'IDDivZones' => "divZones_" . $idImage, 'nextURL' => $this->creerUrl('', 'imageDetail', array('archiIdImage' => $nextImage['idImage'], 'archiRetourAffichage' => 'evenement', 'archiRetourIdName' => 'idEvenement', 'archiRetourIdValue' => $_GET['archiRetourIdValue'], "formatPhoto" => $format)), 'prevURL' => $this->creerUrl('', 'imageDetail', array('archiIdImage' => $prevImage['idImage'], 'archiRetourAffichage' => 'evenement', 'archiRetourIdName' => 'idEvenement', 'archiRetourIdValue' => $_GET['archiRetourIdValue'], "formatPhoto" => $format)), 'list' => rawurlencode(json_encode($imgList)), 'imgID' => rawurlencode(json_encode(array($fetch['idHistoriqueImage'], $fetch['idImage']))), 'imgDate' => $fetch['dateUpload'], 'orgId' => $fetch['idImage'], 'format' => $format));
         //$this->urlImagesGrand.$fetch['dateUpload'].'/'.$fetch['idHistoriqueImage'].".jpg"
         // si affichage du detail sans modification ,  on affiche les zones cliquables
         // pour la selection de zone modifiable
         // on ne l'affiche que si l'image figure dans la table _adresseImage et comporte des adresses sur lesquelles le champ vueSur est a 1
         if (count($arrayInfosImage['vueSurLiens']) > 0 && $authentification->estConnecte() && $u->isAuthorized('selection_zones_photo', $authentification->getIdUtilisateur())) {
             if ($u->getIdProfil($authentification->getIdUtilisateur()) == 4 || $u->isModerateurFromVille($authentification->getIdUtilisateur(), $idImage, 'idImage')) {
                 $styleMenuZoneSelection = "";
                 if (isset($this->variablesGet['archiSelectionZone']) && $this->variablesGet['archiSelectionZone'] == '1') {
                     // menu en rouge si on est sur la selection de zone
                     $styleMenuZoneSelection = "color:#FF0000;";
                 }
                 $t->assign_block_vars('selectionZonesCliquables', array('styleMenuZoneSelection' => $styleMenuZoneSelection, 'urlSelectionZone' => $this->creerUrl('', 'imageDetail', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue'], 'archiSelectionZone' => 1, 'formatPhoto' => $formatPhotoUrl))));
             }
         }
         $authentifie = new archiAuthentification();
         // gestion du lien de retour à la page précédente
         if (isset($this->variablesGet['archiRetourAffichage']) && isset($this->variablesGet['archiRetourIdName']) && isset($this->variablesGet['archiRetourIdValue'])) {
             //$t->assign_block_vars('isRetour',  array('urlRetour'=>$this->creerUrl('',  $this->variablesGet['archiRetourAffichage'],  array($this->variablesGet['archiRetourIdName']=>$this->variablesGet['archiRetourIdValue']))));
             // affichage de l'encars des adresses
             $idEvenementGroupeAdresse = $evenement->getIdEvenementGroupeAdresseFromIdEvenement($this->variablesGet['archiRetourIdValue']);
             if ($idPerson = archiPersonne::isPerson($idEvenementGroupeAdresse)) {
                 $person = new archiPersonne();
                 $infos = $person->getInfosPersonne($idPerson);
                 $html .= "<h2 class='h1'><a href='" . $this->creerUrl('', '', array('archiAffichage' => 'evenementListe', 'selection' => "personne", 'id' => $idPerson)) . "'>" . $infos["prenom"] . " " . $infos["nom"] . "</a></h2>";
             } else {
                 $html .= $adresse->afficherRecapitulatifAdresses($idEvenementGroupeAdresse);
             }
             $t->assign_vars(array('urlModifierImage' => $this->creerUrl('', 'modifierImage', array('archiIdImageModification' => $idImage, 'archiIdEvenementGroupeAdresseAffichageAdresse' => $idEvenementGroupeAdresse))));
         } elseif (isset($idAdresseRetour) && $idAdresseRetour != '' && $idAdresseRetour != '0') {
             $resIdGroupeAdresse = $adresse->getIdEvenementGroupeAdresseFromAdresse($idAdresseRetour);
             $fetchIdGroupeAdresse = mysql_fetch_assoc($resIdGroupeAdresse);
             $html .= $adresse->afficherRecapitulatifAdresses($fetchIdGroupeAdresse['idEvenement']);
             $t->assign_vars(array('urlModifierImage' => $this->creerUrl('', 'modifierImage', array('archiIdImageModification' => $idImage, 'archiIdEvenementGroupeAdresseAffichageAdresse' => $fetchIdGroupeAdresse['idEvenement']))));
         } else {
             $t->assign_vars(array('urlModifierImage' => $this->creerUrl('', 'modifierImage', array('archiIdImageModification' => $idImage))));
         }
         // ***********************************************************************************************************************
         if (isset($this->variablesGet['archiRetourIdName']) && $this->variablesGet['archiRetourIdName'] == 'idEvenement' && isset($this->variablesGet['archiRetourIdValue'])) {
             $reqVerifZone = "\n                    SELECT 0\n                    FROM _adresseImage ai\n                    WHERE\n                        ai.idImage='" . $idImage . "'\n                    AND ai.idEvenementGroupeAdresse = '" . $this->variablesGet['archiRetourIdValue'] . "'\n                    AND vueSur='1'\n                    AND ai.coordonneesZoneImage<>''\n                    AND ai.largeurBaseZoneImage<>''\n                    AND ai.longueurBaseZoneImage<>''\n\n                ";
             $resVerifZone = $this->connexionBdd->requete($reqVerifZone);
             if (mysql_num_rows($resVerifZone) > 0) {
                 $imageZoom = $this->getUrlRacine() . "imageZoomZone.php?idImage=" . $idImage . "&idEvenementGroupeAdresse=" . $this->variablesGet['archiRetourIdValue'] . "&idAdresseCourante=" . $idAdresseReference . "&date=" . $fetch['dateUpload'] . "&idHistorique=" . $fetch['idHistoriqueImage'];
                 $t->assign_vars(array('imageZoom' => "<img src='{$imageZoom}' alt=''>"));
                 $t->assign_vars(array('txtZoom' => "<br>" . _("L'image ci-dessus est un zoom de l'image ci-dessous :")));
             }
         }
         $licence = $this->getLicence($idImage);
         $textLicence = "<img src='images/licences/" . $licence["logo"] . "' alt=''/> ";
         if (!empty($licence["link"])) {
             $textLicence .= "<a rel='license' href='" . $licence["link"] . "'>";
         }
         $textLicence .= $licence["name"];
         if (!empty($licence["link"])) {
             $textLicence .= "</a>";
         }
         $auteur = $this->getAuteur($idImage);
         if (is_array($auteur)) {
             if (!empty($auteur["nom"]) && $auteur["nom"] != " ") {
                 $textLicence .= " (<span itemprop='author'><a rel='author' href='profil-" . $auteur["id"] . ".html'>" . $auteur["nom"] . "</a></span>)";
             }
         } else {
             $textLicence .= " (<span itemprop='author'>" . $auteur . "</span>)";
         }
         $t->assign_vars(array("licence" => $textLicence));
         // ***********************************************************************************************************************
         ob_start();
         $t->pparse('detailImage');
         $html .= ob_get_contents();
         ob_end_clean();
         $image = new imageObject();
         $html .= $image->getJsSetOpacityFunction();
         $html .= $image->getJsCodeDrawFunctions();
         if (isset($this->variablesGet['archiSelectionZone']) && $this->variablesGet['archiSelectionZone'] == '1') {
             // recuperation des longueur et largeur de l'image affiché pour avoir le rapport de base entre ces deux dimensions,  comme cela on pourra reporter les zones sur les images d'autres longueurs et largeurs grace au taux calculé
             $calque = new calqueObject(array('idPopup' => 'popupSelectAdresseVueSurZone'));
             // calque de selection d'adresse une fois que la zone est selectionnee
             $html .= $calque->getDiv(array('height' => 300, 'lienSrcIFrame' => $this->creerUrl('', 'affichePopupSelectionZoneVueSur', array("noHeaderNoFooter" => '1', "archiIdImage" => $idImage)), "titre" => "Selectionnez l'adresse de la zone", "codeJsFermerButton" => "location.href=location.href;"));
             $html .= "<script  >" . $calque->getJsToDragADiv() . "</script>";
             // fonctions de trace,  obligatoire si on veut afficher les zones
             $html .= $image->getJsCodeSelectionZone(array('nomIDImage' => 'divImage', 'tracePolygoneResultat' => true, 'onZoneSelectedAction' => "\n                                        document.getElementById('" . $calque->getJSDivId() . "').style.display='block';\n                                        imageElement = document.getElementById('imageAfficheeID');\n                                        document.getElementById('largeurBaseImageZoneSelection').value=imageElement.clientWidth;\n                                        document.getElementById('longueurBaseImageZoneSelection').value=imageElement.clientHeight;\n                                ", 'addHTMLElementsToFormValidatedAfterZoneSelection' => "<input type='hidden' id='idAdresseRetourZone' name='idAdresseRetourZone' value=''>\n                                <input type='hidden' name='largeurBaseImageZoneSelection' id='largeurBaseImageZoneSelection' value=''>\n                                <input type='hidden' name='longueurBaseImageZoneSelection' id='longueurBaseImageZoneSelection' value=''>\n                                ", 'actionFormValidateZone' => $this->creerUrl('enregistreZoneImage', 'imageDetail', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue']))));
         }
         // affichage des zones existantes,  map sur l'image et divs des formes
         if ($formatPhoto == 'moyenRedim') {
             // vu que le format de la photo moyenRedim est generé a la volée,  il faut calculer les hauteurs et largeurs en fonction d'une autre photo. Ici on prendra le format grand c'est suffisamment precis pas besoin de prendre le format original
             // les photos redimensionnées ont une largeur X de 700px ,  voir le htaccess
             $sizes = getimagesize($this->getCheminPhysiqueImage("grand") . $fetch['dateUpload'] . "/" . $fetch['idHistoriqueImage'] . ".jpg");
             // on converti les dimensions
             $sizeX = 0;
             $sizeY = 0;
             if ($sizes[0] >= $sizes[1]) {
                 $sizeX = 700;
                 $sizeY = round(700 * $sizes[0] / $sizes[1]);
             } else {
                 $sizeY = 700;
                 $sizeX = round(700 * $sizes[1] / $sizes[0]);
             }
             $arrayZones = $this->getDivsAndMapsZonesImagesVueSur(array("idImage" => $idImage, 'largeurImageCourante' => $sizeX, 'longueurImageCourante' => $sizeY));
         } else {
             $sizes = getimagesize($this->getCheminPhysique() . "images/" . $formatPhoto . "/" . $fetch['dateUpload'] . "/" . $fetch['idHistoriqueImage'] . ".jpg");
             $arrayZones = $this->getDivsAndMapsZonesImagesVueSur(array("idImage" => $idImage, 'largeurImageCourante' => $sizes[0], 'longueurImageCourante' => $sizes[1]));
         }
         $html .= $arrayZones['htmlDivs'];
         $html .= $arrayZones['htmlMaps'];
         $html .= $arrayZones['htmlJs'];
     }
     return $html;
 }
<?php

require_once __DIR__ . '/../modules/archi/includes/archiPersonne.class.php';
require_once __DIR__ . '/../modules/archi/includes/archiEvenement.class.php';
require_once __DIR__ . '/../modules/archi/includes/archiImage.class.php';
$person = new ArchiPersonne($_GET['idPerson']);
$event = new ArchiEvenement($_GET['idEvent']);
echo "<h2>Sélection de l'image principale pour " . $person->prenom . ' ' . $person->nom . " sur l'événement " . $event->getTitle() . '</h2>';
$dummyImage = new ArchiImage($row['idImage']);
$reqImages = $dummyImage->getImagesFromEvenement(array('select' => 'hi1.idImage', 'idEvenement' => $_GET['idEvent']));
$res = $dummyImage->connexionBdd->requete($reqImages);
echo '<ul>';
while ($row = mysql_fetch_assoc($res)) {
    $image = new ArchiImage($row['idImage']);
    echo '<li><img src="getPhotoSquare.php?id=' . $image->getIdHistoriqueImage() . '" /></li>';
}
echo '</ul>';