Ecco il file php da inserire nella cartella f24hr.
Codice:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
div.picture {
float: left;
width: 130px;
height: 99px;
padding: 10px;
background-color: #ADD8E6;
margin: 2px;
border-right: 2px solid black;
border-bottom: 2px solid black;
text-align: center;
}
img.thumb {
width: 110px;
height: 80px;
border: none;
padding: 0;
margin: 0;
}
h1 {
background-color: #ADD8E6;
text-align: center;
border: 1px solid #00008B;
margin-bottom: 0.2em;
font-family: sans-serif;
color: #00008B;
padding: 0.2em;
}
</style>
<?php
/*****definisco le variabili globali*****/
$titolo="Archivio webcam 24 ore";
$name_web="ore_*.jpg";
$webcam_name="Webcam foscam";
/****************************************/
echo "<title>".$titolo."</title>\n</head>\n<body>";
$snaps = glob($name_web);
$l=0;
$m=0;
while ($l < count($snaps) ) {
if ( date("U",filemtime($snaps[$l])) > (time()-86400)){
$snaps_clean[$m]=$snaps[$l];
$snaps_date[$m]=date("U",filemtime($snaps[$l]));
$m++;
}
$l++;
}
array_multisort($snaps_date, SORT_DESC,$snaps_clean);
$i = $_GET['p'];
if ( isset($i) && ($i >= 0) && ( $i < count($snaps_clean)) ) {
//
// Single image view
//
$filename = $snaps_clean[$i];
echo "<h1>Immagine scattata il ".date('d.m.Y, H:i',filemtime($snaps_clean[$i]))."</h1>\n";
echo "<p style=\"text-align: center\">";
if ( $i > 0 ) {
$prev = $i-1;
echo "<a href=\"?p=$prev\">Sucessiva</a> ";
} else {
echo "Sucessiva ";
}
echo "<a href=\"archivio24ore.php\" title=\"Snapshots Index\">Index</a> ";
if ( $i < count($snaps_clean)-1 ) {
$next = $i+1;
echo "<a href=\"?p=$next\">Precedente</a>";
} else {
echo "Next";
}
echo "</p>\n";
echo "<p style=\"text-align: center\">\n";
echo "<a href=\"".$filename."\"><img style=\"width: 800px\" alt=\"Immagine scattata il ".date('d.m.Y at H:i',filemtime($snaps_clean[$i]))."\" src=\"".$filename."\"/></a>\n";
echo "</p>\n";
} else {
//
// Image thumbnail page
//
echo "<h1>".$webcam_name."</h1>\n";
echo "<p style=\"text-align: center;\">Back to the <a href=\"archivio24ore.php\" title=\"Meteo Snapshots Index\">gallery index</a></p>\n";
$i = 0;
foreach( $snaps_clean as $filename ) {
$filename = $snaps_clean[$i];
echo "<div class=\"picture\">";
echo "<a name=\"img$i\"/>";
echo "<a href=\"?p=$i\" title=\"Immagine scattata il ".date('d.m.Y at H:i',filemtime($snaps_clean[$i]))."\">";
$thumbname=$filename;
//if ( file_exists($thumbname) ) {
echo "<img class=\"thumb\" alt=\"Immagine scattata il ".date('d.m.Y at H:i',filemtime($snaps_clean[$i]))."\" src=\"".$thumbname."\"/>";
//} else {
// echo "$t";
// }
echo "</a><br/>".date('d.m.Y H:i',filemtime($snaps_clean[$i]))."</div>\n";
$i++;
}
}
?>
</body></html>
Segnalibri