<?php
   header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
 header('Cache-Control: no-cache, must-revalidate');
 header('Pragma: no-cache');
 include("fotoweb19.php");
 include("fotoweb46.php");
 include("../fotoweb57.php");

   $Toolkit_Dir="../../marker/";

   
   if (isset($_GET['codeTheme'])) $codeTheme=$_GET['codeTheme'];
 else $codeTheme=$_POST['idCodeTheme'];
  if (!isset($nomTheme)) { $ModeRefresh=1;
  $queryTheme = "SELECT nomTheme,repertoire,panoramique FROM theme WHERE codeTheme ='".$codeTheme."'";
 $resultTheme = mysql_query ($queryTheme) or die ("La requête de sélection des Themes a échoué");
 $lineTheme = mysql_fetch_row($resultTheme);
 $repertoire = $lineTheme[1];
 $nomTheme = $lineTheme[0];
 $panoramique=$lineTheme[2];
 /* Free resultset */ mysql_free_result($resultTheme);
  $queryIm = "SELECT nom,prive FROM image WHERE codeTheme ='".$codeTheme."'";
 $resultIm = mysql_query ($queryIm) or die ("La requête de sélection des images en base a échoué");
  $TabBasePub=array();
 $TabBasePriv=array();
 $TabBaseVip=array();
  while ($lineIm = mysql_fetch_row($resultIm)){ if ($lineIm[1]==0) $TabBasePub[]=$lineIm[0];
 if ($lineIm[1]==1) $TabBasePriv[]=$lineIm[0];
 if ($lineIm[1]==2) $TabBaseVip[]=$lineIm[0];
  } /* Free resultset */ mysql_free_result($resultIm);
 }  
 ?>  
 <html> <head> <link rel='stylesheet' href='../ergonomie/style.css'> <script language='javascript' src='script/scriptadmin.js'></script> </head> <body> <FORM id="formAdmin" METHOD='POST' ACTION="fotoweb38.php"> <span class='description'>(3/3) Création des thumbnails : <br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;- Ici, on affiche les photos du thème ainsi que certaines caractéristiques IPTC et EXIFF.<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- On créé également les vignettes (thumbnails) correspondants.<br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;- ATTENTION ! En cas de warning Cliquez sur raffraichir jusqu'à disparition de ces derniers!<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- les lectures IPTC de commentaires soft etc ... sont finalement désactivées pour de meilleures perf . </span><br><br> <p align="right"> 
<?php
echo "<img src='../ergonomie/_images/raffraichir.gif' id='btRaffraichir' name='btRaffraichir' onClick=\"raffraichir();\" style='cursor:pointer;cursor:hand' alt='Recharger la page' title='Recharger la page'></p>";
 $pathRepertoirePublic = "../../".$repertoire;
 $pathRepertoirePrive = "../../".$repertoire."/prive";
 $pathRepertoireVip = "../../".$repertoire."/vip";
  if ($dirPublic = @opendir($pathRepertoirePublic)) { $tabImage = array();
 $indice = 1;
 while($file = readdir($dirPublic)) {  if ( ($file != ".") && ($file != "..") && (substr($file,0,6) != "petit_") && ((getExtension($file) == "jpg") || (getExtension($file) == "jpeg") || (getExtension($file) == "JPG") || (getExtension($file) == "JPEG")) ) { $tabImage = array_pad($tabImage, $indice, $file);
 $indice ++;
 } } closedir($dirPublic);
 }  if ($ModeRefresh==1) { $priv = 0;
 while (list($keyB, $nomB) = each($TabBasePub) ) { $NomImageAEffacer=$nomB;
 while (list($keyR, $nomR) = each($tabImage)) {  if ($nomR==$nomB){ $NomImageAEffacer='';
 break;
 } } reset ($tabImage);
 if ($NomImageAEffacer <> '') include("fotoweb31.php");
 } }  $tabImagePrive = array();
 $indicePrive = 1;
 if ($dirPrive = @opendir($pathRepertoirePrive)) { while($file = readdir($dirPrive)) { if ( ($file != ".") && ($file != "..") && (substr($file,0,6) != "petit_") && ((getExtension($file) == "jpg") || (getExtension($file) == "jpeg") || (getExtension($file) == "JPG") || (getExtension($file) == "JPEG")) ) { $tabImage = array_pad($tabImage, $indice, $file);
 $indice ++;
 $tabImagePrive = array_pad($tabImagePrive, $indicePrive, $file);
 $indicePrive ++;
 } } closedir($dirPrive);
 }  if ($ModeRefresh==1) { $priv = 1;
 while (list($keyB, $nomB) = each($TabBasePriv)) { $NomImageAEffacer=$nomB;
 while (list($keyR, $nomR) = each($tabImagePrive)) {  if ($nomR==$nomB){ $NomImageAEffacer='';
 break;
 } } reset ($tabImagePrive);
 if ($NomImageAEffacer <> '') include("fotoweb31.php");
  } }   $tabImageVip = array();
 $indiceVip = 1;
 if ($dirVip = @opendir($pathRepertoireVip)) { while($file = readdir($dirVip)) { if ( ($file != ".") && ($file != "..") && (substr($file,0,6) != "petit_") && ((getExtension($file) == "jpg") || (getExtension($file) == "jpeg") || (getExtension($file) == "JPG") || (getExtension($file) == "JPEG")) ) { $tabImage = array_pad($tabImage, $indice, $file);
 $indice ++;
 $tabImageVip = array_pad($tabImageVip, $indiceVip, $file);
 $indiceVip ++;
 } } closedir($dirVip);
 }  if ($ModeRefresh==1) { $priv = 2;
 while (list($keyB, $nomB) = each($TabBaseVip)) { $NomImageAEffacer=$nomB;
 while (list($keyR, $nomR) = each($tabImageVip)) {  if ($nomR==$nomB){ $NomImageAEffacer='';
 break;
 } } reset ($tabImageVip);
 if ($NomImageAEffacer <> '') include("fotoweb31.php");
 } }  $str_NomTheme = str_replace('\\','',$nomTheme);
  echo "<br><center><span class='titreTheme'>".$str_NomTheme."</span>";
 echo "<table border='1' width='100%' class='image'>";
 echo 	"<tr>";
 echo 		"<td width='10%' class='valeur' align='center'>Nom</td>";
 echo 		"<td width='5%'  class='valeur' align='center'>Accès</td>";
 echo 		"<td width='20%' class='valeur' align='center'>Titre</td>";
 echo 		"<td width='15%' class='valeur' align='center'>Soft</td>";
 echo 		"<td width='10%' class='valeur' align='center'>Date</td>";
 echo 		"<td width='5%'  class='valeur' align='center'>Creation thumbnail</td>";
 echo 		"<td width='5%'  class='valeur' align='center'>Lecture iptc</td>";
 echo 		"<td width='30%' class='valeur' align='center'>Commentaire</td>";
 echo 	"</tr>";
  $nbPrive = 0;
 $nbPublic = 0;
 $nbVip=0;
 $accessPrive = "";
 sort($tabImage);
 while (list($k, $v) = each($tabImage)) { $starttb="";
 $endtb="";
 $startiptc="";
 $endiptc="";
 $file = $v;
 $accessPrive = "0";
 $img = "../../$repertoire/$file";
 while (list($kp, $vp) = each($tabImagePrive)) { if ($v == $vp) { $file = $v;
 $accessPrive = "1";
 $img = "../../$repertoire/prive/$file";
 $nbPrive ++;
 $targetfile = "../../$repertoire/prive/petit_".getRepertoire($file);
 if (file_exists($targetfile)) {  if (filesize($targetfile)<100){ unlink($targetfile);
 $starttb = getmicrotime();
 resizeToFile($img,$targetfile,$panoramique);
 $endtb = getmicrotime();
 }  }else{ $starttb = getmicrotime();
 resizeToFile($img,$targetfile,$panoramique);
 $endtb = getmicrotime();
 } break;
 } } reset($tabImagePrive);
  while (list($kvip, $vvip) = each($tabImageVip)) { if ($v == $vvip) { $file = $v;
 $accessPrive = "2";
 $img = "../../$repertoire/vip/$file";
 $nbVip ++;
 $targetfile = "../../$repertoire/vip/petit_".getRepertoire($file);
 if (file_exists($targetfile)) {  if (filesize($targetfile)<100){ unlink($targetfile);
 $starttb = getmicrotime();
 resizeToFile($img,$targetfile,$panoramique);
 $endtb = getmicrotime();
 }  }else{ $starttb = getmicrotime();
 resizeToFile($img,$targetfile,$panoramique);
 $endtb = getmicrotime();
 } break;
 } } reset($tabImageVip);
  if ($accessPrive == "0") { $nbPublic ++;
 $targetfile = "../../$repertoire/petit_".getRepertoire($file);
 if (file_exists($targetfile)) {  if (filesize($targetfile)<100){ unlink($targetfile);
 $starttb = getmicrotime();
 resizeToFile($img,$targetfile,$panoramique);
 $endtb = getmicrotime();
 }  }else{ $starttb = getmicrotime();
 resizeToFile($img,$targetfile,$panoramique);
 $endtb = getmicrotime();
 } }  $titre = "";
 $date = "";
 $dateTimeOriginale = getDatePrise($img);
 $commentaire = "";
 $soft = "";
 $dateTimeOriginale = ($dateTimeOriginale == "" ? "&nbsp;" : $dateTimeOriginale);
 if (($file != "accueil.jpg") && ($file != "Accueil.jpg")) { include("fotoweb34.php");
  } else if ($file == "Accueil.jpg") rename("../../$repertoire/$file","../../$repertoire/accueil.jpg");
 echo 	"<tr>";
 echo 		"<td class='image'>&nbsp;$file </td>";
 if ($accessPrive == "1") { echo	"<td class='image' align='center'><img src='../ergonomie/_images/prive.gif'></td>";
 } else if ($accessPrive == "2") { echo	"<td class='image' align='center'><img src='../ergonomie/_images/vip.gif'></td>";
 } else if ($accessPrive == "0") { echo	"<td class='image' align='center'><img src='../ergonomie/_images/public.gif'></td>";
 } echo		"<td class='image'>".$titre."</td>";
 echo		"<td class='image'>".$soft."</td>";
 echo		"<td class='image' align='center'>".$dateTimeOriginale."</td>";
 echo		"<td class='image' align='right'>".intval(($endtb - $starttb) * 1000)."ms &nbsp;</td>";
 echo		"<td class='image' align='right'>".intval(($endiptc - $startiptc) * 1000)."ms &nbsp;</td>";
 echo		"<td class='image'>".$commentaire."</td>";
 echo	"</tr>";
 } echo "</table><br><br>";
 echo "<table border='0' width='30%'>";
 echo 	"<tr>";
 echo 		"<td align='center' class='textSimple'><img src='../ergonomie/_images/public.gif'>&nbsp;".$nbPublic." public</td>";
 echo 		"<td align='center' class='textSimple'><img src='../ergonomie/_images/prive.gif'>&nbsp;".$nbPrive." privé</td>";
 echo 		"<td align='center' class='textSimple'><img src='../ergonomie/_images/vip.gif'>&nbsp;".$nbVip." vip</td>";
 echo 	"</tr>";
 echo "</table>";
 echo		"<br><img src='../ergonomie/_images/terminer.gif' id='terminer' name='terminer' onClick='terminerTheme();' style='cursor:pointer;cursor:hand' alt='Termine la création du thème' title='Termine la création du thème'>";
  echo		"<input type='hidden' id='idCodeTheme' name='idCodeTheme' value='".$codeTheme."'>";
 echo		"<input type='hidden' id='idTheme' name='idTheme' value='".$nomTheme."'>";
 echo		"<input type='hidden' id='idRep' name='idRep' value='".$repertoire."'>";
 ?> 
 </center>   </body> </form> </html> 