<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Photos</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    
  
    
<style>
.grid { 
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(800px, 1fr));
  grid-gap: 200px;
  align-items: center;
  padding-left: 2%;
  }
.grid img {
  border: 1px solid #ccc;
  box-shadow: 2px 2px 6px 0px  rgba(0,0,0,0.3);
  max-width: 100%;
	
}
.grid #col {
	grid-auto-rows: 1fr;
  border: 3px solid #ccc;
  box-shadow: 2px 2px 6px 0px  rgba(0,0,0,0.3);
  max-width: 100%;
	
}


	</style>
	</head>

<body>

    <div class="container">
    
         <div style="float: left;" >
       <form method='post' action='index.html' name='demande'>
            <button name='dnumdevis' type='submit' value="0">HOME</button>
				</form></div>
        
        <div style="float: right;" >
           <form method='post' action='listepicpost.php' name='demande'>
            <button name='dnumdevis' type='submit' value="0">LISTE CLIENTS</button>
				</form>
            </div>
        <div style="float: right;" >
         <form method='post' action='picviewlist.php' name='demande'>
            <button name='dnumdevis' type='submit' value="<?php print $_POST['dnumdevis']; ?>">LISTE PHOTOS</button>
            </form>
        </div>
            <div style="float: right;" >
             <form method='post' action='picviewlist4.php' name='demande'>
            <button name='dnumdevis' type='submit' value="<?php print $_POST['dnumdevis']; ?>">LISTE PHOTOS COLONNES</button>
</form>
        </div>
        <br>
        
        
 <!--  <div id="myCarousel" class="carousel slide" data-ride="carousel"> -->
        <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="0"> 
 

  <!-- Wrapper for slides -->
  <div class="carousel-inner">
      
      	
	<?php
	
	
		
			//sudo -u _www mount_afp -I //user@host/share /path/to/mountpoint pour server distant sur /Users/serve
		  $files = glob("/Users/serve/Downloads/*.*");
	// $files = glob("img/*.*");
	// $files = glob("ftp://franco:franco1@192.168.2.70/DocumentsPublics/*.*");
	//$files = glob("Volumes/idisk/*.*");
	
	 $files = glob("photos/".$_POST['dnumdevis']."/tmb/*.*");
    $filesFull = glob("photos/".$_POST['dnumdevis']."/tmb2/*.*");
	
    for ($i=0; $i<count($files); $i++)
     {
       $image = $files[$i];
        $imageFull = $filesFull[$i];
       $supported_file = array(
               
               'jpg',
               'png',
               'jpeg'
              
        );
 
        $ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
        if (in_array($ext, $supported_file)) {
           //echo basename($image)."<br />"; // show only image name if you want to show full path then use this code // echo $image."<br />";
			//echo "<li><a href='".$dirname.$curimg."'><img src='img.php?src=".$dirname.$curimg."&w=300&zc=1' alt='' /></a></li>n ";
			
			//echo "<a href='imagetempfull.php?img=".$imageFull."' > ";
			//echo "<img src='imagetemp.php?img=".$image."' alt='Random image' /></a>";
			//echo $image;
		//print "<div id='col'>".$image."</div>";	
            
             if ($i==0) {
            print "<div class='item active'><img src='".$imageFull."' alt='image' style='width:100%';></div>";
            } else { print "<div class='item'><img src='".$imageFull."' alt='image' style='width:100%';></div>";}
            
            
           } else {
               continue;
           }
         }
	?>
      
      
      

  </div>

  <!-- Left and right controls -->
  <a class="left carousel-control" href="#myCarousel" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#myCarousel" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right"></span>
    <span class="sr-only">Next</span>
  </a>
</div> 
    
    
         <!-- Indicators -->
        <br><br>
  <div style="clear: both;"></div>
        
 
   
           	
	<?php
	
	
		
			//sudo -u _www mount_afp -I //user@host/share /path/to/mountpoint pour server distant sur /Users/serve
		  $files = glob("/Users/serve/Downloads/*.*");
	// $files = glob("img/*.*");
	// $files = glob("ftp://franco:franco1@192.168.2.70/DocumentsPublics/*.*");
	//$files = glob("Volumes/idisk/*.*");
	
	 $files = glob("photos/".$_POST['dnumdevis']."/tmb/*.*");
    $filesFull = glob("photos/".$_POST['dnumdevis']."/tmb2/*.*");
	
    for ($i=0; $i<count($files); $i++)
     {
       $image = $files[$i];
        $imageFull = $filesFull[$i];
       $supported_file = array(
               
               'jpg','jpeg',
               'png'
              
        );
 
        $ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
        if (in_array($ext, $supported_file)) {
           //echo basename($image)."<br />"; // show only image name if you want to show full path then use this code // echo $image."<br />";
			//echo "<li><a href='".$dirname.$curimg."'><img src='img.php?src=".$dirname.$curimg."&w=300&zc=1' alt='' /></a></li>n ";
			
			//echo "<a href='imagetempfull.php?img=".$imageFull."' > ";
			//echo "<img src='imagetemp.php?img=".$image."' alt='Random image' /></a>";
			//echo $image;
		//print "<div id='col'>".$image."</div>";	
            
             if ($i==0) {
            print "<div data-target='#myCarousel' data-slide-to=".$i." style='display: inline-block;padding-left=200px;margin-right: 10px;margin-top: 10px;' ><img src='imagetemp.php?img=".$image."&exctf=".$ext."' alt='Random image' data-value='".$image."' /></div>";
            } else { print "<div data-target='#myCarousel' data-slide-to=".$i." style='display: inline-block;margin-right: 10px;margin-top: 10px;'><img src='imagetemp.php?img=".$image."&exctf=".$ext."' alt='Random image'  data-value='".$image."'/></div>";}
            
            
           } else {
               continue;
           }
         }
	?>
      
      
  <script>
        
        $(document).ready(function(){
    $('img').dblclick(function(){
        // do something
        //alert('Picture fade out...');
        downloadLink=$(this).data('value');
        fileExtension = downloadLink.substr((downloadLink.lastIndexOf('.') + 1));
        //alert(fileExtension);  // .jpg
        if (fileExtension=== 'png') {
        downloadLink=downloadLink.replace("tmb", "doc");
        downloadLink=downloadLink.replace(".png", ".pdf");
      //  alert(downloadLink);
        window.open(downloadLink,'_blank');
            }
       
    });
});
        </script>    
    
   
     
        
        
        
    </div>
    
       
  
    
	

</body>
</html>
