Files
motion/letztenbilder.php
2026-01-30 11:10:47 +01:00

201 lines
5.0 KiB
PHP
Executable File

<?php
# letztenbilder.php
include('config.inc.php');
$datei = basename(__FILE__);
$anzahl = isset($_GET['anzahl']) ? $_GET['anzahl'] : '';
$linkvon = isset($_GET['linkvon']) ? $_GET['linkvon'] : '';
$cam = isset($_GET['cam']) ? $_GET['cam'] : '';
$sort = isset($_GET['sort']) ? $_GET['sort'] : '';
if( isset($_GET['n']) ){
if (in_array($_GET['n'], $inc_array_n)) $n = $_GET['n'];
else $n = reset($inc_array_n);
}else{
$n = reset($inc_array_n);
}
if( isset($_GET['m']) ){
if (in_array($_GET['m'], $inc_array_m)) $m = $_GET['m'];
else $m = reset($inc_array_m);
}else{
$m = reset($inc_array_m);
}
$heute = date("Y-m-d");
$bilder_array=last_x_jpg_in_folder($inc_pfad_www.$heute."/".$cam."/",$anzahl);
#Sort
if($inc_x_sort=="dsc"){
if($sort=="asc") asort($bilder_array,SORT_STRING); #ASC
else{
arsort($bilder_array,SORT_STRING); #DSC
$sort="dsc";
}
}elseif($inc_x_sort=="asc"){
if($sort=="dsc") arsort($bilder_array,SORT_STRING); #DSC
else{
asort($bilder_array,SORT_STRING); #ASC
$sort="asc";
}
}else{
if($sort=="asc") asort($bilder_array,SORT_STRING); #ASC
else{
arsort($bilder_array,SORT_STRING); #DSC
$sort="dsc";
}
}
$bilder_gefunden=count($bilder_array);
# immer aufrunden
$html_zeilen = ceil($bilder_gefunden / $inc_x_bilder_pro_zeile);
echo "<!DOCTYPE HTML>\n";
echo "<html>\n";
echo "<head>\n";
echo "<title></title>\n";
echo "<meta http-equiv=\"refresh\" content=\"$inc_letzte_x_refresh\">\n";
echo "<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">\n";
#echo "<style type=\"text/css\">\n";
#echo "td { font-family: sans-serif; font-size: 16px; }\n";
#echo "#td1 { vertical-align: top; }\n";
#echo "#imgmini { min-width: 160px; }\n";
#echo "</style>\n";
echo "</head>\n";
echo "<body>\n";
#echo "<div style=\"margin-left: 3%;margin-right: 3%;\">\n";
# outer Geruest
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td>\n";
# Kopf
echo "<header>\n";
echo "<div id=\"divheader\">\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>";
echo "<td><span id=\"spanheader\">".htmlentities($inc_label_kopf, ENT_QUOTES)."</span></td>";
# echo "<td align=\"right\"><a id=abtnback href=\"index.php\" title=\"\"><span>zur&uuml;ck</span></a></td>";
echo "<td align=\"right\">";
echo "<img style=\"display:block;\" src=\"./$inc_logo\" width=\"$inc_logo_breite\"></a>";
echo "</td>";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "</header>\n";
# inner Geruest
#echo "<table border=\"0\" cellpadding=\"20\" cellspacing=\"0\" width=\"100%\">\n";
echo "<table border=\"0\" id=\"tableinner\" width=\"100%\">\n";
echo "<tr><td align=\"left\"><a id=abtnback href=\"index.php?n=$n&m=$m\" title=\"\"><span>zur&uuml;ck</span></a></td></tr>";
echo "<tr>\n";
echo "<td>\n";
# Haupt
echo "<table border=\"0\" width=\"100%\">\n";
echo "<tr>";
echo "<td>";
if($sort=="asc"){
$styleasc="aascdecu";
$styledsc="aascdec";
$bolda1="<b>";
$bolda2="</b>";
$boldd1="";
$boldd2="";
}elseif($sort=="dsc"){
$styleasc="aascdec";
$styledsc="aascdecu";
$bolda1="";
$bolda2="";
$boldd1="<b>";
$boldd2="</b>";
}else{
$styleasc="aascdecu";
$styledsc="aascdec";
$bolda1="<b>";
$bolda2="</b>";
$boldd1="";
$boldd2="";
}
echo "<span style=\"font-size: 22px;\"><b>$cam</b></span>&nbsp;(&nbsp;";
echo "<a id=\"abtnascdsc\" href=\"$datei?cam=$cam&anzahl=$anzahl&min=$min&sort=asc&linkvon=$linkvon&n=$n&m=$m\">".$bolda1."aufsteigend".$bolda2."</a>&nbsp;/&nbsp;";
echo "<a id=\"abtnascdsc\" href=\"$datei?cam=$cam&anzahl=$anzahl&min=$min&sort=dsc&linkvon=$linkvon&n=$n&m=$m\">".$boldd1."absteigend".$boldd2."</a>&nbsp;)";
echo "</td>";
echo "</tr>\n";
echo "<tr>";
echo "<td><span id=span16>Die letzten $anzahl Bilder von heute: $bild</span></td>";
echo "</tr>\n";
echo "</table>\n";
$last="";
$g=0;
$td=0;
foreach($bilder_array AS $bilddateiname) {
$teil=explode($inc_pfad_www.$heute."/".$cam."/", $bilddateiname);
$test=$teil[1];
$new=substr($test,0,5);
#aenderung -> neue tabelle
if($last != $new or $td>=$inc_x_bilder_pro_zeile) {
$td=0;
if($g>0) {
echo "</tr>\n";
echo "</table>\n";
}
echo "<table border=\"1\" bgcolor=\"#EEEEEE\">\n";
echo "<tr>\n";
echo "<td><span style=\"font-size: 18px;\">".substr($test,0,2).":".substr($test,3,2)."</span></td>\n";
}
echo "<td><a href=\"einzelbild.php?bild=".$heute."/".$cam."/".$test."&cam=$cam&anzahl=$anzahl&linkvon=$datei&n=$n&m=$m\"><img id=imgmini src=\"".$heute."/".$cam."/".$test."\" width=\"160\" height=\"120\"></a></td>";
$g++;
$td++;
$last=$new;
}
echo "</table>\n";
# Ende Geruest
echo "</td>";
echo "</tr>";
echo "</table>\n";
# Ende Geruest
echo "</td>";
echo "</tr>";
echo "</table>\n";
#echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
# gibt pfad+dateiname der letzten x jpg in dem ordner
function last_x_jpg_in_folder($d,$x) {
$files = glob($d."*.jpg");
return array_slice($files, -$x);
}
?>