<!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=utf-8" />
<title>Live web camera</title>
<link rel="stylesheet" href="styles.css" type="text/css">

</head>

<body style="padding: 0px; margin: 0px; color: #000;">


<?php 
function get_oldest_file($directory) {
   if  ($handle = opendir($directory)) {
	   while (false !== ($file = readdir($handle))) {
		   $files[] = $file;
	   }
	   foreach ($files as $val) {
		   if (is_file($directory.$val)) {
				$file_date[$val] = filemtime($directory.$val);
		   }
	   }
   }

   closedir($handle);
   arsort($file_date, SORT_NUMERIC);
   reset($file_date);
   $oldest = key($file_date);
   return $oldest;
} 

//  example: 
$lastfile = get_oldest_file("/home/olympicv/public_html/images/");
//$newfile="http://www.travelling-greece.com/webcams/santorini/oia2/oia.jpg";
//$oldfile="http://www.travelling-greece.com/webcams/santorini/oia2/".$lastfile;
?> 


<!--<img src="/images/<?php echo $lastfile; ?>" alt="Oia Santorini webcam" width="533">-->
<img src="http://www.travelling-greece.com/webcams/santorini/oia2/oia.jpg" alt="Oia Santorini webcam" width="533">

</body>
</html>