<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Photos</title>
	
<style>
.grid { 
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(300px, 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: 90%;
	
}
.grid #col {
	grid-auto-rows: 1fr;
  border: 3px solid #ccc;
  box-shadow: 2px 2px 6px 0px  rgba(0,0,0,0.3);
  max-width: 40%;
	
}
	</style>
	</head>

<body>
	<!-- 
<img src="imagetemp.php?img=image01.jpg" /> -->
	
<main class="grid">
	
	<?php
	

    
$parent_link2 = 'photos';
  
    

function dirToArray($parent_link2, $dir) { 

    $result = array(); 

  //  $cdir = ftp_nlist($ftpConnection, $dir); 
    foreach ($parent_link2 as $key => $value) 
    { 
        $subs_value = substr($value, strlen($dir) + 1);
        // assuming its a folder if there's no dot in the name 
        if (strpos($value, '.') === false) {
            $result[$subs_value] = dirToArray($parent_link2, $value);
        }
        else
        {
            $result[] = $subs_value;
        }
    } 
    return $result; 
}
    

	
    for ($i=0; $i<count($files); $i++)
     {
       $image = $files[$i];
       $supported_file = array(
               
               'jpg',
               '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=".$parent_link2.'/'.$image."' > ";
			echo "<img src='imagetemp.php?img=".$parent_link2.'/'.$image."' alt='Random image' /></a>";
			//echo $image;
		//print "<div id='col'>".$image."</div>";	
           } else {
               continue;
           }
         }

     
    ?>

	</main>
</body>
</html>
