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

294 lines
8.4 KiB
PHP
Executable File

<?php
# allebilder.php
include('config.inc.php');
$datei = basename(__FILE__);
$heute = date("Y-m-d");
$anzahl = isset($_GET['anzahl']) ? $_GET['anzahl'] : '';
$linkvon = isset($_GET['linkvon']) ? $_GET['linkvon'] : '';
$cam = isset($_GET['cam']) ? $_GET['cam'] : '';
$datum = isset($_GET['datum']) ? $_GET['datum'] : $heute;
$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);
}
$bilder_array=jpg_in_folder($inc_pfad_www.$datum."/".$cam."/");
#print_r($bilder_array);
#$inc_bilder_pro_zeile = 6;
#Sort
if($inc_alle_sort=="dsc"){
if($sort=="asc") asort($bilder_array,SORT_STRING); #ASC
else{
arsort($bilder_array,SORT_STRING); #DSC
$sort="dsc";
}
}elseif($inc_alle_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);
#echo $bilder_gefunden;
# immer aufrunden
$html_zeilen = ceil($bilder_gefunden / $inc_alle_bilder_pro_zeile);
#echo $html_zeilen;
echo "<!DOCTYPE HTML>\n";
echo "<html>\n";
echo "<head>\n";
echo "<title></title>\n";
echo "<meta http-equiv=\"refresh\" content=\"$inc_letzte_refresh\">\n";
echo "<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">\n";
echo "</head>\n";
echo "<body>\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\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo "<td><span id=\"spanheader\">".htmlentities($inc_label_kopf, ENT_QUOTES)."</span></td>\n";
echo "<td align=\"right\">\n";
echo "<img style=\"display:block;\" src=\"./$inc_logo\" width=\"$inc_logo_breite\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "</header>\n";
# inner Geruest
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>\n";
echo "<tr>\n";
echo "<td>\n";
# Haupt
echo "<table border=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td>\n";
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&datum=$datum&sort=asc&linkvon=$linkvon&n=$n&m=$m\">".$bolda1."aufsteigend".$bolda2."</a>&nbsp;/&nbsp;";
echo "<a id=\"abtnascdsc\" href=\"$datei?cam=$cam&datum=$datum&sort=dsc&linkvon=$linkvon&n=$n&m=$m\">".$boldd1."absteigend".$boldd2."</a>&nbsp;)";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><a name=\"0\"><span id=span16>Alle $bilder_gefunden Bilder vom $datum $bild:</span></a></td>\n";
echo "</tr>\n";
echo "</table>\n";
$lastjpg="";
$lasthhmm="";
$arg="";
$array_streifenbilder = array();
$g=1;
$td=0;
$reihen=1;
$muster_datum = "/[0-9]{4}-[0-9]{2}-[0-9]{2}/";
$muster_uhrzeit = "/[0-9]{2}-[0-9]{2}-[0-9]{2}-/";
$ratio = $bilder_gefunden / $inc_alle_bilder_pro_zeile;
$ratio_recommend = 500;
if( $ratio > 2*$ratio_recommend ){
$ratio_multiplier = $ratio / $ratio_recommend;
$inc_alle_bilder_pro_zeile = round($inc_alle_bilder_pro_zeile * $ratio_multiplier);
if( $inc_alle_bilder_pro_zeile > 60 ) $inc_alle_bilder_pro_zeile = 30;
}
#echo "<br>ratio: ".$ratio;
#echo "<br>ratio_recommend: ".$ratio_recommend;
#echo "<br>ratio_multiplier: ".$ratio_multiplier;
#echo "<br>bilder die zeile: ".$inc_alle_bilder_pro_zeile;
foreach($bilder_array AS $bilddateiname) {
#$bilddateiname = str_replace('/mini/','/',$bilddateiname);
preg_match($muster_datum, $bilddateiname, $array_datum_bild);
preg_match($muster_uhrzeit, $bilddateiname, $array_uhrzeit_bild);
$datum_bild = $array_datum_bild[0];
$uhrzeit_bild = str_replace('-',':',rtrim($array_uhrzeit_bild[0],'-'));
$teil=explode($inc_pfad_www.$datum."/".$cam."/", $bilddateiname);
$newjpg=$teil[1];
$newhhmm=substr($newjpg,0,5);
if($g==1) {
#$lasthhmm=$newhhmm;
#$lastjpg=$newjpg;
}
#echo "$lastjpg $newjpg";
#$arg.="&bilder[]=" . $datum . "/" . $cam . "/mini/" . $lastjpg;
#$array_streifenbilder[] = $datum . "/" . $cam . "/mini/" . $newjpg;
#$array_datum[] = $datum_bild;
#$array_uhrzeit[] = $uhrzeit_bild;
#aenderung -> neue tabelle
#if($lastjpg != $newjpg or $td>=$inc_alle_bilder_pro_zeile or $g==count($bilder_array) ) {
if( ($lasthhmm != $newhhmm or $td>=$inc_alle_bilder_pro_zeile) and $g>1 ) {
echo "<table border=\"1\" bgcolor=\"#EEEEEE\">\n";
echo "<tr>\n";
echo "<td><a name=\"$reihen\"><span style=\"font-size: 18px;\">".substr($lastjpg,0,2).":".substr($lastjpg,3,2)."</span></a></td>\n";
echo "<td><img id=imgmini src=\"/".$datum."/".$cam."/".$newjpg."\" width=\"160\" height=\"120\" usemap=\"#map".$reihen."\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<map name=\"map".$reihen."\">\n";
$a=0;
foreach($array_streifenbilder AS $streifenabschnitt) {
$x1=$a*160;
$y1=0;
$x2=($a+1)*160;
$y2=119;
#$href_part = str_replace("/mini/","/",$streifenabschnitt);
$href="einzelbild.php?bild=".$href_part."&cam=$cam&r=$reihen&anzahl=$anzahl&datum=$datum&linkvon=$datei&n=$n&m=$m";
$alttitle=$array_datum[$a]."\n".$array_uhrzeit[$a];
echo "<area shape=\"RECT\" coords=\"$x1,$y1,$x2,$y2\" href=\"$href\" alt=\"$alttitle\" title=\"$alttitle\">\n";
$a++;
}
echo "</map>\n";
unset($array_streifenbilder);
unset($array_datum);
unset($array_uhrzeit);
$arg="";
$reihen++;
$td=0;
}
$arg.="&bilder[]=" . $datum . "/" . $cam . "/" . $newjpg;
$array_streifenbilder[] = $datum . "/" . $cam . "/" . $newjpg;
$array_datum[] = $datum_bild;
$array_uhrzeit[] = $uhrzeit_bild;
# letzte reihe nicht vergessen und ausgeben
if( $g==count($bilder_array) ) {
#echo "letzte zeile";
echo "<table border=\"1\" bgcolor=\"#EEEEEE\">\n";
echo "<tr>\n";
echo "<td><a name=\"$reihen\"><span style=\"font-size: 18px;\">".substr($lastjpg,0,2).":".substr($lastjpg,3,2)."</span></a></td>\n";
echo "<td><img id=imgmini src=\"/".$datum."/".$cam."/".$newjpg."\" width=\"160\" height=\"120\" usemap=\"#map".$reihen."\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<map name=\"map".$reihen."\">\n";
$a=0;
#$array_streifenbilder[] = $datum . "/" . $cam . "/mini/" . $newjpg;
foreach($array_streifenbilder AS $streifenabschnitt) {
$x1=$a*160;
$y1=0;
$x2=($a+1)*160;
$y2=119;
#$href_part = str_replace("/mini/","/",$streifenabschnitt);
$href="einzelbild.php?bild=".$href_part."&cam=$cam&r=$reihen&anzahl=$anzahl&datum=$datum&linkvon=$datei&n=$n&m=$m";
$alttitle=$array_datum[$a]."\n".$array_uhrzeit[$a];
echo "<area shape=\"RECT\" coords=\"$x1,$y1,$x2,$y2\" href=\"$href\" alt=\"$alttitle\" title=\"$alttitle\">\n";
$a++;
}
echo "</map>\n";
unset($array_streifenbilder);
unset($array_datum);
unset($array_uhrzeit);
}
#$arg.="&bilder[]=" . $datum . "/" . $cam . "/mini/" . $lastjpg;
$g++;
$td++;
$lastjpg=$newjpg;
$lasthhmm=$newhhmm;
}
# Ende Geruest
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
# Ende Geruest
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
#echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
# gibt pfad+dateiname der jpg in dem ordner
function jpg_in_folder($d) {
$files = glob($d."*.jpg");
return $files;
}
?>