<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
    function mtimecmp($a, $b) {
        $mt_a = filemtime($a);
        $mt_b = filemtime($b);

        if ($mt_a == $mt_b)
            return 0;
        else if ($mt_a < $mt_b)
            return -1;
        else
            return 1;
    }

    $images = glob($dirname."*");
    usort($images, "mtimecmp");
    $images=array_reverse($images);

    foreach ($images as $image) {
      echo "<div style='font-size:12px; float:left; background: linear-gradient(to bottom, #ffffff 0%, #99ccff 70%, #ccffcc 100%); 
      margin:4px; width:100px; height:122px; font-family:arial; padding:4px 0; border-radius:5px; border:1px solid black;'> 
      <center><a href='$image'>$image <br> <img src='$image' title='$image'  border='1px' width='80' height='80' vspace='5px'></a></center>
      <a href='delete.php?do=$image'><span style='color:#000; font-size:16px;'><center> X Delete</center></span></a><br>
      </div>";
    }
?>

<?php /*
$dir = "./";
if (is_dir($dir)){
  if ($dh = opendir($dir)){
    while (($file = readdir($dh)) !== false){
        
    if($file == "index.php")
    continue;
    if($file == "tree.php")    
    continue;
    if($file == "thumbs")    
    continue;
    if($file == "delete.php")    
    continue;
    if($file == "error_log")    
    continue;    
    if($file == ".")
    continue;
    if($file == "..")
    continue;
      echo "<div style='font-family:arial; font-size:12px;float:left; border:1px solid black;margin:3px;padding:3px; width:100px; border-radius:7px; background: linear-gradient(to top, #99ccff 0%, #ffffff 75%);'> "; 
      echo " <center> $file <br> <a href='../images/$file'> <img src='$file' border='1px' title='$file' width='80' height='80' vspace='5px'> </a> <br>
      <a href='delete.php?do=$file'><span style='color:#000; font-size:16px;'><center> X Delete</center></span></a><br></center>";
      echo "  </div>";
    }
    closedir($dh);
  }
}
*/?>








