This commit is contained in:
2026-01-30 11:10:47 +01:00
parent c00299abb9
commit 33111583a3
11 changed files with 2479 additions and 0 deletions

293
allebilder.php Executable file
View File

@@ -0,0 +1,293 @@
<?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;
}
?>

97
config.inc.php Executable file
View File

@@ -0,0 +1,97 @@
<?php
#############################################################
# Konfigurations Datei für Webcams mit Motion
#############################################################
# Pfad wo motion die Ordner mit den Bildern speichert
$inc_pfad_www = "/z/motion/";
#################################
# KAMERAS
#################################
# Kamera Namen die in dem Linux Ordner sind
# wird normal in motion config eingestellt
$inc_cams = array( "cam2", "cam3" );
$inc_cams_label = array( "AXIS Companion Cube L 1", "AXIS Companion Cube L 2" );
#################################
# INDEX / STARTSEITE
#################################
$inc_cam_ampel = 60; #Kamera Ampel rot bei x Minuten
$inc_index_cam_pro_zeile = 2; #Kameras pro Zeile auf der Startseite/Index
$inc_index_bild_breite = "600"; #skalierte Breite der Kamerabilder auf der Startseite/Index
# 450-2500 normal 800
#################################
# Bilder und Zeitraum vor/zurueck
#################################
$inc_array_n = array(7,20,50,100,200,300,400,500); #n Bilder
$inc_array_m = array(1,2,5,10,30,60,120); #mind. m Min. an Bilder
#################################
# LOGO + TEXT
#################################
$inc_logo = "logo.gif";
$inc_logo_breite = "150";
$inc_text = "powered by motion";
#################################
# SEITEN REFRESH
#################################
$inc_index_letztes_refresh = 60; #Startseite letztes motion Bild
$inc_index_aktuell_refresh = 10; #Startseite aktuelles Kamerabild
$inc_letzte_x_refresh = 60; #Letzten x Anzahl Bilder
$inc_letzte_min_refresh = 60; #Letzten y Minuten Bilder
$inc_einzel_refresh = 60; #Einzelbild
#################################
# LETZTEN X BILDER
#################################
$inc_letzten_bilder = 40; #Letzten x Bilder anzeigen
$inc_letzten_bilder2 = 80; #Letzten x Bilder anzeigen
$inc_x_bilder_pro_zeile = 6; #Bilder pro Zeile
$inc_x_sort = "dsc"; #default Sortierung asc dsc
#################################
# LETZTEN Y MINUTEN MIT BILDERN
#################################
$inc_letzten_min = 20; #Bilder von den letzten x Minuten anzeigen
$inc_letzten_min2 = 60; #Bilder von den letzten x Minuten anzeigen
$inc_min_bilder_pro_zeile = 5; #Bilder pro Zeile
$inc_min_sort = "dsc"; #default Sortierung asc dsc
#################################
# ALLES VON ...
#################################
$inc_alle_bilder_pro_zeile = 6; #Bilder pro Zeile
$inc_alle_sort = "asc"; #default Sortierung asc dsc
#################################
# HTML Label
#################################
$inc_label_titel = "Webcams mit Motion";
$inc_label_kopf = "Webcams mit Motion";
# Einzelbild Ansicht Groesse
#$inc_einzelbild_prozent = "66%";

784
einzelbild.php Executable file
View File

@@ -0,0 +1,784 @@
<?php
# $datei
include('config.inc.php');
$datei = basename(__FILE__);
$heute = date("Y-m-d");
$URL=$_SERVER['REQUEST_URI'];
#echo $URL;
$bild = isset($_GET['bild']) ? $_GET['bild'] : '';
$linkvon = isset($_GET['linkvon']) ? $_GET['linkvon'] : 'index.php';
$cam = isset($_GET['cam']) ? $_GET['cam'] : '';
$anzahl = isset($_GET['anzahl']) ? $_GET['anzahl'] : '';
$min = isset($_GET['min']) ? $_GET['min'] : '';
$rotate = isset($_GET['rotate']) ? $_GET['rotate'] : '0';
$datum = isset($_GET['datum']) ? $_GET['datum'] : $heute;
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'motion';
$pos = isset($_GET['pos']) ? $_GET['pos'] : '';
$b = isset($_GET['b']) ? $_GET['b'] : '800';
$r = isset($_GET['r']) ? $_GET['r'] : '0';
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);
}
#print_r($inc_array_n);
if(!isset($breite) or $breite=="" or $breite < 300 or $breite > 2000 ) $breite=800;
if($linkvon!="index.php" and $linkvon!="allebilder.php" and $linkvon!="letztenbilder.php" and $linkvon!="letztenbildermin.php") $linkvon="index.php";
$bilder_array=jpg_in_folder($inc_pfad_www.$datum."/".$cam."/");
asort($bilder_array,SORT_STRING);
#$bildpos = array_search($inc_pfad_www.$bild, $bilder_array);
$bildcount = count($bilder_array);
$bildanfang="";
$bildmende="";
if($bild == "") {
#$bilder_array=jpg_in_folder($inc_pfad_www.$datum."/".$cam."/");
#asort($bilder_array,SORT_STRING);
#$bildcount = count($bilder_array);
if( $pos == "anfang" ) {
#
#str_replace("$inc_pfad_www","",$bilder_array[0]);
$bild=str_replace("$inc_pfad_www","",$bilder_array[0]);
}elseif( $pos == "ende") {
#
$bild=str_replace("$inc_pfad_www","",$bilder_array[$bildcount-1]);
}else{
#
}
#echo $bildanfang;
#echo $bildende;
}
$bildplus="";
$bildminus="";
$bildplus2="";
$bildminus2="";
$bildplus3="";
$bildminus3="";
$bildplusn="";
$bildminusn="";
if($bild != "") {
# $bilder_array=jpg_in_folder($inc_pfad_www.$datum."/".$cam."/");
# asort($bilder_array,SORT_STRING);
$bildpos = array_search($inc_pfad_www.$bild, $bilder_array);
# $bildcount = count($bilder_array);
if( $bildpos < ($bildcount-1) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-1]);
$bildplus=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+1]);
}
if( $bildpos >= 1 ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-1]);
$bildminus=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-1]);
}
if( $bildpos < ($bildcount-2) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-2]);
$bildplus2=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+2]);
}
if( $bildpos >= 2 ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-2]);
$bildminus2=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-2]);
}
if( $bildpos < ($bildcount-3) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-3]);
$bildplus3=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+3]);
}
if( $bildpos >= 3 ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-3]);
$bildminus3=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-3]);
}
if( $bildpos < ($bildcount-$n) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-$n]);
$bildplusn=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+$n]);
}
if( $bildpos >= $n ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-$n]);
$bildminusn=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-$n]);
}
$condition_plus = bilder_array_plus_min($bild,$bilder_array,$m);
if( $condition_plus != null ){
str_replace("$inc_pfad_www","",$condition_plus);
$bildplusm=str_replace("$inc_pfad_www","",$condition_plus);
}
$condition_minus = bilder_array_minus_min($bild,$bilder_array,$m);
if( $condition_minus != null ){
str_replace("$inc_pfad_www","",$condition_minus);
$bildminusm=str_replace("$inc_pfad_www","",$condition_minus);
}
#echo $bild;
#echo "m ".$m;
#print_r($bilder_array);
#$testarray = bilder_array_plus_min($bild,$bilder_array,$m);
#$testarray2 = bilder_array_minus_min($bild,$bilder_array,$m);
#print_r($testarray);
#echo "<br>bildneuplus ".$bildplusm;
#echo "<br>bildneuminus ".$bildminusm;;
# echo "<br>aktuell:".$bild;
# echo "<br>minus:".$bildminus;
# echo "<br> plus:".$bildplus;
# echo "<br>minus2:".$bildminus2;
# echo "<br> plus2:".$bildplus2;
# echo "<br>minus3:".$bildminus3;
# echo "<br> plus3:".$bildplus3;
# echo "<br> bildpos:".$bildpos;
# echo "<br> bildcount:".$bildcount;
}
#print_r($bilder_array);
$taste_bildminus="/motion/"."$datei?bild=$bildminus&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildplus="/motion/"."$datei?bild=$bildplus&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildminus3="/motion/"."$datei?bild=$bildminus3&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildplus3="/motion/"."$datei?bild=$bildplus3&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildminusn="/motion/"."$datei?bild=$bildminusn&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildplusn="/motion/"."$datei?bild=$bildplusn&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildminusm="/motion/"."$datei?bild=$bildminusm&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
$taste_bildplusm="/motion/"."$datei?bild=$bildplusm&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n&m=$m";
# datum bekommen
$muster_datum = "/[0-9]{4}-[0-9]{2}-[0-9]{2}/";
$muster_uhrzeit = "/[0-9]{2}-[0-9]{2}-[0-9]{2}-/";
preg_match($muster_datum, $bild, $array_datum_bild);
preg_match($muster_uhrzeit, $bild, $array_uhrzeit_bild);
preg_match($muster_datum, $bildminus, $array_datum_bild_minus);
preg_match($muster_uhrzeit, $bildminus, $array_uhrzeit_bild_minus);
preg_match($muster_datum, $bildplus, $array_datum_bild_plus);
preg_match($muster_uhrzeit, $bildplus, $array_uhrzeit_bild_plus);
preg_match($muster_datum, $bildminus2, $array_datum_bild_minus2);
preg_match($muster_uhrzeit, $bildminus2, $array_uhrzeit_bild_minus2);
preg_match($muster_datum, $bildplus2, $array_datum_bild_plus2);
preg_match($muster_uhrzeit, $bildplus2, $array_uhrzeit_bild_plus2);
preg_match($muster_datum, $bildminus3, $array_datum_bild_minus3);
preg_match($muster_uhrzeit, $bildminus3, $array_uhrzeit_bild_minus3);
preg_match($muster_datum, $bildplus3, $array_datum_bild_plus3);
preg_match($muster_uhrzeit, $bildplus3, $array_uhrzeit_bild_plus3);
preg_match($muster_datum, $bildminusn, $array_datum_bild_minusn);
preg_match($muster_uhrzeit, $bildminusn, $array_uhrzeit_bild_minusn);
preg_match($muster_datum, $bildplusn, $array_datum_bild_plusn);
preg_match($muster_uhrzeit, $bildplusn, $array_uhrzeit_bild_plusn);
preg_match($muster_datum, $bildminusm, $array_datum_bild_minusm);
preg_match($muster_uhrzeit, $bildminusm, $array_uhrzeit_bild_minusm);
preg_match($muster_datum, $bildplusm, $array_datum_bild_plusm);
preg_match($muster_uhrzeit, $bildplusm, $array_uhrzeit_bild_plusm);
$datum_bild = $array_datum_bild[0];
$uhrzeit_bild = str_replace('-',':',rtrim($array_uhrzeit_bild[0],'-'));
$datum_bild_minus = $array_datum_bild_minus[0];
$uhrzeit_bild_minus = str_replace('-',':',rtrim($array_uhrzeit_bild_minus[0],'-'));
$datum_bild_minus2 = $array_datum_bild_minus2[0];
$uhrzeit_bild_minus2 = str_replace('-',':',rtrim($array_uhrzeit_bild_minus2[0],'-'));
$datum_bild_minus3 = $array_datum_bild_minus3[0];
$uhrzeit_bild_minus3 = str_replace('-',':',rtrim($array_uhrzeit_bild_minus3[0],'-'));
$datum_bild_minusn = $array_datum_bild_minusn[0];
$uhrzeit_bild_minusn = str_replace('-',':',rtrim($array_uhrzeit_bild_minusn[0],'-'));
$datum_bild_minusm = $array_datum_bild_minusm[0];
$uhrzeit_bild_minusm = str_replace('-',':',rtrim($array_uhrzeit_bild_minusm[0],'-'));
$datum_bild_plus = $array_datum_bild_plus[0];
$uhrzeit_bild_plus = str_replace('-',':',rtrim($array_uhrzeit_bild_plus[0],'-'));
$datum_bild_plus2 = $array_datum_bild_plus2[0];
$uhrzeit_bild_plus2 = str_replace('-',':',rtrim($array_uhrzeit_bild_plus2[0],'-'));
$datum_bild_plus3 = $array_datum_bild_plus3[0];
$uhrzeit_bild_plus3 = str_replace('-',':',rtrim($array_uhrzeit_bild_plus3[0],'-'));
$datum_bild_plusn = $array_datum_bild_plusn[0];
$uhrzeit_bild_plusn = str_replace('-',':',rtrim($array_uhrzeit_bild_plusn[0],'-'));
$datum_bild_plusm = $array_datum_bild_plusm[0];
$uhrzeit_bild_plusm = str_replace('-',':',rtrim($array_uhrzeit_bild_plusm[0],'-'));
#echo $datum_bild;
#echo $uhrzeit_bild;
#echo "<br>".$taste_links;
#echo "<br>".$taste_rechts;
echo "<!DOCTYPE HTML>\n";
echo "<html>\n";
echo "<head>\n";
echo "<title></title>\n";
if($mode=="live") $refresh=$inc_index_aktuell_refresh;
else $refresh=$inc_einzel_refresh;
echo "<meta http-equiv=\"refresh\" content=\"$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 "</style>\n";
echo "</head>\n";
echo "<body onload=\"javascript:checkScreen()\">\n";
#echo "<div style=\"margin-left: 3%;margin-right: 3%;\">\n";
echo "<script language=\"Javascript\">\n";
#echo "function checkScreen(){\n";
#echo "document.getElementById(\"divimg\").width = 100;\n";
#echo "}\n";
echo "function fPressed() {\n";
if( $bildplusm!="" ) echo "window.location = '".$taste_bildplusm."';\n";
echo "}\n";
echo "function aPressed() {\n";
if( $bildminusm!="" ) echo "window.location = '".$taste_bildminusm."';\n";
echo "}\n";
echo "function dPressed() {\n";
if( $bildplusn!="" ) echo "window.location = '".$taste_bildplusn."';\n";
echo "}\n";
echo "function sPressed() {\n";
if( $bildminusn!="" ) echo "window.location = '".$taste_bildminusn."';\n";
echo "}\n";
echo "function rPressed() {\n";
if( $bildplus3!="" ) echo "window.location = '".$taste_bildplus3."';\n";
echo "}\n";
echo "function qPressed() {\n";
if( $bildminus3!="" ) echo "window.location = '".$taste_bildminus3."';\n";
echo "}\n";
echo "function wPressed() {\n";
if( $bildminus!="" ) echo "window.location = '".$taste_bildminus."';\n";
echo "}\n";
echo "function ePressed() {\n";
if( $bildplus!="" ) echo "window.location = '".$taste_bildplus."';\n";
echo "}\n";
echo "document.onkeydown = function(evt) {\n";
echo "evt = evt || window.event;\n";
echo "switch (evt.keyCode) {\n";
echo "case 70:\n";
echo "fPressed();\n";
echo "break;\n";
echo "case 65:\n";
echo "aPressed();\n";
echo "break;\n";
echo "case 83:\n";
echo "sPressed();\n";
echo "break;\n";
echo "case 68:\n";
echo "dPressed();\n";
echo "break;\n";
echo "case 81:\n";
echo "qPressed();\n";
echo "break;\n";
echo "case 82:\n";
echo "rPressed();\n";
echo "break;\n";
echo "case 69:\n";
echo "ePressed();\n";
echo "break;\n";
echo "case 87:\n";
echo "wPressed();\n";
echo "break;\n";
echo "}\n";
echo "};\n";
echo "</script>\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 style=\"font-size: 22px;\"><b>".htmlentities($inc_label_kopf . " - " . $cam, ENT_QUOTES)."</b></span></td>";
echo "<td align=\"right\">";
echo "<img style=\"display:block;\" src=\"./$inc_logo\" width=\"$inc_logo_breite\">";
echo "</td>";
#echo "<td align=\"right\"><a id=abtnback href=\"$linkvon?datum=$datum&cam=$cam&anzahl=$anzahl&min=$min\" title=\"\"><span>zur&uuml;ck</span></a></td>";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "</header>\n";
if($b==400) $bold400="<b>400 Pixel</b>";
else $bold400="400 Pixel";
if($b==800) $bold800="<b>800 Pixel</b>";
else $bold800="800 Pixel";
if($b==1200) $bold1200="<b>1200 Pixel</b>";
else $bold1200="1200 Pixel";
if($b==1600) $bold1600="<b>1600 Pixel</b>";
else $bold1600="1600 Pixel";
echo "<table border=\"0\" id=\"tableinnereinzel\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td id=\"tdtop\" width=\"150\">\n";
# linke menuleiste
echo "<table border=\"0\" id=\"tableinnereinzel\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td align=\"left\"><a id=abtnback href=\"$linkvon?datum=$datum&cam=$cam&mode=$mode&anzahl=$anzahl&n=$n&m=$m&min=$min#".($r-2)."\" title=\"\"><span>zur&uuml;ck</span></a></td>\n";
echo "</tr>\n";
# < > << >> <<< >>>
if($mode!="live"){
echo "<tr>";
echo "<td id=\"tdnowrap\">";
if($bildminus!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildminus&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">-1 Bild</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
if($bildplus!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildplus&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">+1 Bild</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
echo "</td>";
echo "</tr>\n";
#echo "<tr>";
#echo "<td id=\"tdnowrap\">";
#if($bildminus2!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildminus2&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\"><<</a>";
#else echo "<a id=\"abtnpm\">&nbsp;</a>";
#if($bildplus2!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildplus2&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">>></a>";
#else echo "<a id=\"abtnpm\">&nbsp;</a>";
#echo "</td>";
#echo "</tr>\n";
echo "<tr>";
echo "<td id=\"tdnowrap\">";
if($bildminus3!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildminus3&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">-3 Bilder</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
if($bildplus3!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildplus3&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">+3 Bilder</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
echo "</td>";
echo "</tr>\n";
echo "<tr>";
echo "<td id=\"tdnowrap\">";
if($bildminusn!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildminusn&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">-$n Bilder</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
if($bildplusn!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildplusn&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">+$n Bilder</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
echo "</td>";
echo "</tr>\n";
echo "<tr>";
echo "<td id=\"tdnowrap\">";
if($bildminusm!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildminusm&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">-$m Min</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
if($bildplusm!="") echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&bild=$bildplusm&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">+$m Min</a>";
else echo "<a id=\"abtnpm\">&nbsp;</a>";
echo "</td>";
echo "</tr>\n";
echo "<tr>";
echo "<td id=\"tdnowrap\">";
echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&pos=anfang&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">Anfang</a>";
echo "<a id=\"abtnpm\" href=\"$datei?cam=$cam&pos=ende&rotate=$rotate&r=$r&datum=$datum&anzahl=$anzahl&min=$min&linkvon=$linkvon&b=$b&n=$n&m=$m\">Ende</a>";
echo "</td>";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td><a id=\"abtnascdsc\" href=\"$datei?cam=$cam&bild=$bild&rotate=$rotate&anzahl=$anzahl&mode=$mode&datum=$datum&r=$r&min=$min&linkvon=$linkvon&b=400&n=$n&m=$m\">".$bold400."</a>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><a id=\"abtnascdsc\" href=\"$datei?cam=$cam&bild=$bild&rotate=$rotate&anzahl=$anzahl&mode=$mode&datum=$datum&r=$r&min=$min&linkvon=$linkvon&b=800&n=$n&m=$m\">".$bold800."</a>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><a id=\"abtnascdsc\" href=\"$datei?cam=$cam&bild=$bild&rotate=$rotate&anzahl=$anzahl&mode=$mode&datum=$datum&r=$r&min=$min&linkvon=$linkvon&b=1200&n=$n&m=$m\">".$bold1200."</a>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><a id=\"abtnascdsc\" href=\"$datei?cam=$cam&bild=$bild&rotate=$rotate&anzahl=$anzahl&mode=$mode&datum=$datum&r=$r&min=$min&linkvon=$linkvon&b=1600&n=$n&m=$m\">".$bold1600."</a>\n";
echo "</td>\n";
echo "</tr>\n";
if($mode!="live"){
echo "<tr><td>&nbsp;</td></tr>\n";
echo "<tr><td>&nbsp;</td></tr>\n";
#echo "<tr><td align=\"center\" id=\"fntstatus\">Datum/Uhrzeit</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus2\">$datum_bild</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus3\">$uhrzeit_bild</td></tr>\n";
echo "<tr><td>&nbsp;</td></tr>\n";
#if($mode!="live"){
#echo "<tr><td>&nbsp;</td></tr>\n";
#echo "<tr><td style=\"font-family: monospace; font-size: 12px;\">Tastaturk&uuml;rzel:</td></tr>\n";
#echo "<tr><td style=\"font-family: monospace; font-size: 12px;\">&nbsp;e&nbsp;&nbsp;&nbsp;&nbsp;+1 Bild</td></tr>\n";
#echo "<tr><td style=\"font-family: monospace; font-size: 12px;\">&nbsp;r&nbsp;&nbsp;&nbsp;&nbsp;+3 Bild</td></tr>\n";
#echo "<tr><td style=\"font-family: monospace; font-size: 12px;\">&nbsp;w&nbsp;&nbsp;&nbsp;&nbsp;-1 Bild</td></tr>\n";
#echo "<tr><td style=\"font-family: monospace; font-size: 12px;\">&nbsp;q&nbsp;&nbsp;&nbsp;&nbsp;-3 Bild</td></tr>\n";
#echo "<tr><td>&nbsp;</td></tr>\n";
echo "<tr><td>&nbsp;</td></tr>\n";
# echo "<tr><td align=\"center\" id=\"fntstatus\">Tastaturk&uuml;rzel</td></tr>\n";
#echo "<tr><td align=\"center\" id=\"fntstatus\">q&nbsp;&nbsp;&nbsp;&nbsp;-3 Bilder</td></tr>\n";
#echo "<tr><td align=\"center\" id=\"fntstatus\">w&nbsp;&nbsp;&nbsp;&nbsp;-1 Bilder</td></tr>\n";
#echo "<tr><td align=\"center\" id=\"fntstatus\">e&nbsp;&nbsp;&nbsp;&nbsp;+1 Bilder</td></tr>\n";
#echo "<tr><td align=\"center\" id=\"fntstatus\">r&nbsp;&nbsp;&nbsp;&nbsp;+3 Bilder</td></tr>\n";
#echo "<tr><td align=\"center\" id=\"fntstatus\">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n";
$url_sel_n="/motion/"."$datei?bild=$bild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&m=$m";
$url_sel_m="/motion/"."$datei?bild=$bild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b&n=$n";
echo "<tr><td align=\"center\" id=\"fntstatus\"><select id=slctempty style=\"width:80%;\" \">\n";
echo "<option>1 Bild</option>\n";
echo "</select></td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">w&nbsp;&nbsp;&nbsp;&nbsp;zur&uuml;ck&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">e&nbsp;&nbsp;&nbsp;&nbsp;vorw&auml;rts</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\"><select id=slctempty style=\"width:80%;\"\">\n";
echo "<option>3 Bilder</option>\n";
echo "</select></td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">r&nbsp;&nbsp;&nbsp;&nbsp;zur&uuml;ck&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">q&nbsp;&nbsp;&nbsp;&nbsp;vorw&auml;rts</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\"><select style=\"width:80%;\" onchange=\"location.href='$url_sel_n&n='+this.options[this.selectedIndex].value\">\n";
foreach ($inc_array_n as $wert) {
$selected = "";
if("$n" == "$wert") $selected="selected";
echo "<option value=\"$wert\" $selected>$wert Bilder</option>\n";
}
echo "</select></td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">s&nbsp;&nbsp;&nbsp;&nbsp;zur&uuml;ck&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">d&nbsp;&nbsp;&nbsp;&nbsp;vorw&auml;rts</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\"><select style=\"width:80%;\" onchange=\"location.href='$url_sel_m&m='+this.options[this.selectedIndex].value\">\n";
foreach ($inc_array_m as $wert) {
$selected = "";
if("$m" == "$wert") $selected="selected";
echo "<option value=\"$wert\" $selected>mind. $wert Min.</option>\n";
}
#echo "<option value=\"1\" selected>mind. 1 Min.</option>\n";
#echo "<option value=\"2\">mind. 2 Min.</option>\n";
#echo "<option value=\"5\">mind. 5 Min.</option>\n";
#echo "<option value=\"10\">mind. 10 Min.</option>\n";
#echo "<option value=\"30\">mind. 30 Min.</option>\n";
#echo "<option value=\"60\">mind. 60 Min.</option>\n";
#echo "<option value=\"120\">mind. 120 Min.</option>\n";
echo "</select></td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">a&nbsp;&nbsp;&nbsp;&nbsp;zur&uuml;ck&nbsp;&nbsp;</td></tr>\n";
echo "<tr><td align=\"center\" id=\"fntstatus\">f&nbsp;&nbsp;&nbsp;&nbsp;vorw&auml;rts</td></tr>\n";
echo "<tr><td>&nbsp;</td></tr>\n";
}
echo "</table>\n";
echo "</td>\n";
echo "<td style=\"vertical-align: top;\">";
if($mode=="live"){
clearstatcache();
$bild = scandir_files_live($inc_pfad_www."live/",$cam);
$bild = "live/".$bild;
#echo $bild;
}
# rechter bereich
echo "<table border=\"0\" id=\"tableinnereinzel2\">\n";
# bis zu 7 Mini bilder
if($mode!="live"){
echo "<tr>\n";
if( $bildminus3 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos-2)." (von ".$bildcount.")</td>\n";
if( $bildminus2 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos-1)." (von ".$bildcount.")</td>\n";
if( $bildminus != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos-0)." (von ".$bildcount.")</td>\n";
if( $bild != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+1)." (von ".$bildcount.")</td>\n";
if( $bildplus != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+2)." (von ".$bildcount.")</td>\n";
if( $bildplus2 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+3)." (von ".$bildcount.")</td>\n";
if( $bildplus3 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+4)." (von ".$bildcount.")</td>\n";
echo "</tr>\n";
echo "<tr>\n";
if( $bildminus3 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_minus3</td>\n";
if( $bildminus2 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_minus2</td>\n";
if( $bildminus != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_minus</td>\n";
if( $bild != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild</td>\n";
if( $bildplus != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_plus</td>\n";
if( $bildplus2 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_plus2</td>\n";
if( $bildplus3 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_plus3</td>\n";
echo "</tr>\n";
#echo "<tr>\n";
# if( $bildminus3 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos-2)."/".$bildcount."</td>\n";
# if( $bildminus2 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos-1)."/".$bildcount."</td>\n";
# if( $bildminus != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos-0)."/".$bildcount."</td>\n";
# if( $bild != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+1)."/".$bildcount."</td>\n";
# if( $bildplus != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+2)."/".$bildcount."</td>\n";
# if( $bildplus2 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+3)."/".$bildcount."</td>\n";
# if( $bildplus3 != "" ) echo "<td align=\"center\" id=\"fntinfo\">".($bildpos+4)."/".$bildcount."</td>\n";
#echo "</tr>\n";
echo "<tr>\n";
if( $bildminus3 != "" ){
$pfadbild = $bildminus3;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\">";
echo "<div id=divimg>";
echo "<a href=\"$datei?bild=$pfadbild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b\">";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_minus3\n$uhrzeit_bild_minus3\" title=\"$datum_bild_minus3\n$uhrzeit_bild_minus3\">";
echo "</a>";
echo "</div>";
echo "</td>\n";
}
if( $bildminus2 != "" ){
$pfadbild = $bildminus2;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\">";
echo "<div id=divimg>";
echo "<a href=\"$datei?bild=$pfadbild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b\">";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_minus2\n$uhrzeit_bild_minus2\" title=\"$datum_bild_minus2\n$uhrzeit_bild_minus2\">";
echo "</a>";
echo "</div>";
echo "</td>\n";
}
if( $bildminus != "" ){
$pfadbild = $bildminus;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\">";
echo "<div id=divimg>";
echo "<a href=\"$datei?bild=$pfadbild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b\">";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_minus\n$uhrzeit_bild_minus\" title=\"$datum_bild_minus\n$uhrzeit_bild_minus\">";
echo "</a>";
echo "</div>";
echo "</td>\n";
}
if( $bild != "" ){
$pfadbild = $bild;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\" style=\"border: 5px solid #138a0c;-webkit-border-radius: 4;-moz-border-radius: 4;border-radius: 4px;\">";
echo "<div id=divimg>";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_minus\n$uhrzeit_bild_minus\" title=\"$datum_bild_minus\n$uhrzeit_bild_minus\">";
echo "</div>";
echo "</td>\n";
}
if( $bildplus != "" ){
$pfadbild = $bildplus;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\">";
echo "<div id=divimg>";
echo "<a href=\"$datei?bild=$pfadbild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b\">";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_plus\n$uhrzeit_bild_plus\" title=\"$datum_bild_plus\n$uhrzeit_bild_plus\">";
echo "</a>";
echo "</div>";
echo "</td>\n";
}
if( $bildplus2 != "" ){
$pfadbild = $bildplus2;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\">";
echo "<div id=divimg>";
echo "<a href=\"$datei?bild=$pfadbild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b\">";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_plus2\n$uhrzeit_bild_plus2\" title=\"$datum_bild_plus2\n$uhrzeit_bild_plus2\">";
echo "</a>";
echo "</div>";
echo "</td>\n";
}
if( $bildplus3 != "" ){
$pfadbild = $bildplus3;
$pfadminibild = str_replace("/".$cam."/","/".$cam."/mini/",$pfadbild);
$dateibild = $inc_pfad_www . $pfadbild;
$dateiminibild = $inc_pfad_www . $pfadminibild;
if( file_exists( $dateiminibild ) ) $link = $pfadminibild;
else $link = $pfadbild;
echo "<td id=\"tdnowrap\">";
echo "<div id=divimg>";
echo "<a href=\"$datei?bild=$pfadbild&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b\">";
echo "<img id=imgindex src=\"".$link."\" style=\"width:160px;\" alt=\"$datum_bild_plus3\n$uhrzeit_bild_plus3\" title=\"$datum_bild_plus3\n$uhrzeit_bild_plus3\">";
echo "</a>";
echo "</div>";
echo "</td>\n";
}
echo "</tr>";
#echo "<tr>\n";
# if( $bildminus3 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_minus3</td>\n";
# if( $bildminus2 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_minus2</td>\n";
# if( $bildminus != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_minus</td>\n";
# if( $bild != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild</td>\n";
# if( $bildplus != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_plus</td>\n";
# if( $bildplus2 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_plus2</td>\n";
# if( $bildplus3 != "" ) echo "<td align=\"center\" id=\"fntuhr\">$uhrzeit_bild_plus3</td>\n";
#echo "</tr>\n";
}
echo "</table>\n";
echo "<table border=\"0\" id=\"tableinnereinzel\" >\n";
echo "<tr>";
echo "<td id=td1>";
#echo "<div id=divimg>";
# if($rotate=="90") echo "<img id=rotate90 src=\"$bild\" style=\"width:".$b."px;\">";
# elseif($rotate=="180") echo "<img id=rotate180 src=\"$bild\" style=\"width:".$b."px;\">";
# elseif($rotate=="270") echo "<img id=rotate270 src=\"$bild\" style=\"width:".$b."px;\">";
# else echo "<img id=imgindex src=\"$bild\" style=\"width:".$b."px;\">";
# echo "</div>";
echo "<div id=divimg>";
#if($rotate=="90") echo "<img id=rotate90 src=\"$bild\" style=\"width:".$b."px;\">";
#elseif($rotate=="180") echo "<img id=rotate180 src=\"$bild\" style=\"width:".$b."px;\">";
#elseif($rotate=="270") echo "<img id=rotate270 src=\"$bild\" style=\"width:".$b."px;\">";
#else
echo "<a href=\"".$bild."\" target=\"_blank\">";
echo "<img id=imgindex src=\"$bild\" style=\"width:".$b."px;\">";
echo "</a>";
echo "</div>";
echo "</td>";
echo "</tr>\n";
echo "</table>\n";
#echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
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 jpg in dem ordner
function jpg_in_folder($d) {
$files = glob($d."*.jpg");
return $files;
}
# im bilder array um mind, +m min. weitergehen
function bilder_array_plus_min($bild_alt,$array,$minuten) {
$mind_sekunden = $minuten * 60;
#array in zweiten array mit sekunden umwandeln
$array_sekunden = array();
foreach ($array as $wert) {
preg_match('/[0-9]{2,2}-[0-9]{2,2}-[0-9]{2,2}-[0-9]{1,4}/',$wert, $treffer);
$HH = substr($treffer[0], 0, 2);
$MM = substr($treffer[0], 3, 2);
$SS = substr($treffer[0], 6, 2);
$sekunden_absolut = $HH*3600 + $MM*60 + $SS;
array_push($array_sekunden, $sekunden_absolut);
}
# alten bild wert umrechnen
preg_match('/[0-9]{2,2}-[0-9]{2,2}-[0-9]{2,2}-[0-9]{1,4}/',$bild_alt, $treffer);
$HH = substr($treffer[0], 0, 2);
$MM = substr($treffer[0], 3, 2);
$SS = substr($treffer[0], 6, 2);
$sekunden_absolut = $HH*3600 + $MM*60 + $SS;
$grenze = $sekunden_absolut + $mind_sekunden;
#echo "\nbildalt ".$bild_alt;
#echo "\ngrenze ".$grenze."\n\n";
$index=0;
$gefunden=false;
foreach ($array_sekunden as $wert) {
#echo "\n".$wert;
if( $wert >= $grenze ) {
$gefunden = true;
break;
}
$index++;
}
if($gefunden) return $array[$index];
else return null;
}
function bilder_array_minus_min($bild_alt,$array,$minuten) {
$mind_sekunden = $minuten * 60;
#array in zweiten array mit sekunden umwandeln
$array_sekunden = array();
foreach ($array as $wert) {
preg_match('/[0-9]{2,2}-[0-9]{2,2}-[0-9]{2,2}-[0-9]{1,4}/',$wert, $treffer);
$HH = substr($treffer[0], 0, 2);
$MM = substr($treffer[0], 3, 2);
$SS = substr($treffer[0], 6, 2);
$sekunden_absolut = $HH*3600 + $MM*60 + $SS;
array_push($array_sekunden, $sekunden_absolut);
}
# alten bild wert umrechnen
preg_match('/[0-9]{2,2}-[0-9]{2,2}-[0-9]{2,2}-[0-9]{1,4}/',$bild_alt, $treffer);
$HH = substr($treffer[0], 0, 2);
$MM = substr($treffer[0], 3, 2);
$SS = substr($treffer[0], 6, 2);
$sekunden_absolut = $HH*3600 + $MM*60 + $SS;
$grenze = $sekunden_absolut - $mind_sekunden;
#echo "<br>\nbildalt ".$bild_alt;
#echo "\ngrenze ".$grenze."\n\n";
$index=0;
$gefunden=false;
foreach ($array_sekunden as $wert) {
#echo "\n".$wert;
if( $wert > $grenze ) {
$gefunden = true;
break;
}
$index++;
}
if($gefunden and $index>0) return $array[$index-1];
else return null;
}
function scandir_files_live($d,$cam) {
$array = array_filter(scandir($d), function ($f) use($d,$cam) {
if($f == ".") return false;
elseif($f == "..") return false;
elseif( preg_match("/".$cam."_[0-9]+/", $f) and date("U",filemtime($d.$f)) >= time() - 3) return is_file($d . DIRECTORY_SEPARATOR . $f);
else return false;
});
$array = array_values($array);
return $array[count($array)-2];
}
?>

29
img.php Executable file
View File

@@ -0,0 +1,29 @@
<?php
$jpg_quality = 75;
$bildbreite = isset($_GET['breite']) ? $_GET['breite'] : '160';
$bilder = $_GET['bilder'];
$erstesbild = imagecreatefromjpeg($bilder[0]);
$bildhoehe = imagesy($erstesbild);
imagedestroy($erstesbild);
header('Content-Type: image/jpeg');
$bilderarray = array();
$i=0;
$ergebnisbild = @imagecreatetruecolor($bildbreite * count($bilder), $bildhoehe) or die('Cannot Initialize new GD image stream');
foreach($bilder AS $bild) {
$img = imagecreatefromjpeg($bilder[$i]);
$bilderarray[] = imagecreatefromjpeg($bild);
imagecopy($ergebnisbild,$img, $i * $bildbreite, 0, 0, 0, $bildbreite, $bildhoehe);
$i++;
}
#imagejpeg($ergebnisbild, NULL, 75);
imagejpeg($ergebnisbild, NULL, $jpg_quality);
imagedestroy($ergebnisbild);
?>

39
imgscale.php Executable file
View File

@@ -0,0 +1,39 @@
<?php
$b = isset($_GET['b']) ? $_GET['b'] : '160';
$q = isset($_GET['q']) ? $_GET['q'] : '75';
$bild = $_GET['bild'];
header('Content-Type: image/jpeg');
#$bild_src = imagecreatefromjpeg($bild);
#$bild_neu = imagescale ( $bild_src , $b ,-1 ,IMG_BICUBIC_FIXED);
#imagejpeg( $bild_neu, NULL, $q );
#imagedestroy($tmpbild);
#header('Content-Type: image/jpeg');
#echo "test";
$bild_src = imagecreatefromjpeg($bild);
$height = imagesy($bild_src);
$width = imagesx($bild_src);
$h = round($b/$width*$height);
$bild_neu = imagecreatetruecolor($b, $h);
imagecopyresampled($bild_neu, $bild_src, 0, 0, 0, 0, $b, $h, $width, $height);
imagejpeg( $bild_neu, NULL, $q );
imagedestroy($bild_src);
imagedestroy($bild_neu);
?>

45
imgscalewrite.php Executable file
View File

@@ -0,0 +1,45 @@
<?php
$b = isset($_GET['b']) ? $_GET['b'] : '160';
$q = isset($_GET['q']) ? $_GET['q'] : '75';
$c = isset($_GET['c']) ? $_GET['c'] : 'undef';
$bild = $_GET['bild'];
header('Content-Type: image/jpeg');
#$bild_src = imagecreatefromjpeg($bild);
#$bild_neu = imagescale ( $bild_src , $b ,-1 ,IMG_BICUBIC_FIXED);
#imagejpeg( $bild_neu, NULL, $q );
#imagedestroy($tmpbild);
#header('Content-Type: image/jpeg');
#echo "test";
$bild_src = imagecreatefromjpeg($bild);
$height = imagesy($bild_src);
$width = imagesx($bild_src);
$h = round($b/$width*$height);
$bild_neu = imagecreatetruecolor($b, $h);
imagecopyresampled($bild_neu, $bild_src, 0, 0, 0, 0, $b, $h, $width, $height);
#imagejpeg( $bild_neu, NULL, $q );
imagejpeg( $bild_neu, "./popup/".$c."_".$b.".jpg", $q );
imagedestroy($bild_src);
imagedestroy($bild_neu);
?>

301
index.php Executable file
View File

@@ -0,0 +1,301 @@
<?php
include('config.inc.php');
$datei = basename(__FILE__);
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'motion';
if($mode!="motion" and $mode!="live") $mode="motion";
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");
$gestern = date("Y-m-d",strtotime("-1 days"));
$vorgestern = date("Y-m-d",strtotime("-2 days"));
$vorvorgestern = date("Y-m-d",strtotime("-3 days"));
if($mode=="motion") $seiten_refresh=$inc_index_letztes_refresh;
if($mode=="live") $seiten_refresh=$inc_index_aktuell_refresh;
if($mode=="live"){
$boldl1="<b>";
$boldl2="</b>";
$boldm1="";
$boldm2="";
}elseif($mode=="motion"){
$boldl1="";
$boldl2="";
$boldm1="<b>";
$boldm2="</b>";
}else{
$boldl1="";
$boldl2="";
$boldm1="<b>";
$boldm2="</b>";
}
#phpinfo();
echo "<!DOCTYPE HTML>\n";
echo "<html>\n";
echo "<head>\n";
echo "<title>".htmlentities($inc_label_titel, ENT_QUOTES)."</title>\n";
echo "<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">\n";
echo "<meta http-equiv=\"refresh\" content=\"$seiten_refresh\">\n";
#echo "<style type=\"text/css\">\n";
#echo "td { font-family: sans-serif; font-size: 16px; }\n";
#echo "table { background-color:#FFFFFF;border-collapse:collapse;border:2px solid #000000;color:#000000; }\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\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "<tr>";
echo "<td>";
echo "<span id=\"spanheader\">".htmlentities($inc_label_kopf, ENT_QUOTES)."</span>\n";
echo "&nbsp;(&nbsp;";
echo "<a id=\"abtnlm\" href=\"$datei?mode=live\">".$boldl1."live($inc_index_aktuell_refresh)".$boldl2."</a>";
echo "&nbsp;/&nbsp;";
echo "<a id=\"abtnlm\" href=\"$datei?mode=motion\">".$boldm1."motion($inc_index_letztes_refresh)".$boldm2."</a>";
echo "&nbsp;)";
echo "</td>";
echo "<td align=\"right\">";
echo "<img src=\"./$inc_logo\" width=\"$inc_logo_breite\">";
echo "</td>";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "</header>\n";
# inner Geruest
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td>\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
#echo "<table border=\"0\" id=\"tableinner2\" width=\"100%\">\n";
#echo "<tr>\n";
#echo "<td>\n";
$array_hauptordner = scandir_folders_yyyymmdd($inc_pfad_www);
#print_r($array_hauptordner);
# keine unsinnigen Werte für Cams pro zeile
if( $inc_index_cam_pro_zeile > 0 ) $max_cam_pro_zeile=$inc_index_cam_pro_zeile;
else $max_cam_pro_zeile=2;
$l=0;
$c=0;
#Cam Name und Buttons
#echo "<tr>\n";
foreach($inc_cams AS $cam)
{
if( $c == $max_cam_pro_zeile ) $c=0;
if( $c == 0 ) echo "<tr>\n";
#echo "$cam $c $l $max_cam_pro_zeile<br>";
if( $inc_cams_label[$l] != "" ) $cam_label=$inc_cams_label[$l];
else $cam_label=$cam;
$camampelfarbe=camampel($inc_pfad_www.$heute."/".$cam."/",$inc_cam_ampel);
#echo $camampelfarbe;
echo "<td id=tdtop>\n";
#echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\">\n";
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n";
# CamX 40 Bilder 20 min heute 80 Bilder 60 min gestern
echo "<tr>\n";
echo "<td rowspan=\"2\" width=\"20\" align=\"center\"><span id="."abtnampel".$camampelfarbe."2>&nbsp;&nbsp;</span></td>\n";
#echo "<td rowspan=\"2\" width=\"*\" align=\"center\"><span id=abtn3big><b>$cam_label</b></span></td>\n";
echo "<td rowspan=\"2\" style=\"width:auto;\" align=\"center\"><span id=abtn3big><b>$cam_label</b></span></td>\n";
echo "<td rowspan=\"2\" width=\"30\">\n";
#echo "<select style=\"width:30px;\" id=slctbig onchange=\"location.href=this.options[this.selectedIndex].value\">\n";
echo "<select style=\"width:30px;\" id=slctbig onchange=\"location.href=this.options[this.selectedIndex].value\">\n";
#echo "<option value=\"\" selected>weitere</option>\n";
#echo "<option value=\"\" selected>&nbsp;&nbsp;&nbsp;&nbsp;weitere</option>\n";
echo "<option value=\"\" selected>+</option>\n";
foreach($array_hauptordner AS $eintrag)
{
#echo "<option value=\"allebilder.php?cam=$cam&datum=$eintrag&linkvon=$datei\">$eintrag</option>\n";
echo "<option value=\"allebilder.php?cam=$cam&datum=$eintrag&linkvon=$datei&n=$n&m=$m\">&nbsp;&nbsp;$eintrag</option>\n";
}
echo "</select>\n";
echo "</td>\n";
echo "<td width=\"15%\"><a id=abtn2small href=\"letztenbilder.php?anzahl=$inc_letzten_bilder&cam=$cam&linkvon=$datei&n=$n&m=$m\"><span id=span14>$inc_letzten_bilder Bilder</span></a></td>\n";
echo "<td width=\"15%\"><a id=abtn2small href=\"letztenbildermin.php?min=$inc_letzten_min&cam=$cam&linkvon=$datei&n=$n&m=$m\"><span id=span14>$inc_letzten_min min</span></a></td>\n";
echo "<td width=\"15%\"><a id=abtn2small href=\"allebilder.php?cam=$cam&datum=$heute&linkvon=$datei&n=$n&m=$m\"><span id=span14>heute</span></a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"12%\"><a id=abtn2small href=\"letztenbilder.php?anzahl=$inc_letzten_bilder2&cam=$cam&linkvon=$datei&n=$n&m=$m\"><span id=span14>$inc_letzten_bilder2 Bilder</span></a></td>\n";
echo "<td width=\"12%\"><a id=abtn2small href=\"letztenbildermin.php?min=$inc_letzten_min2&cam=$cam&linkvon=$datei&n=$n&m=$m\"><span id=span14>$inc_letzten_min2 min</span></a></td>\n";
echo "<td width=\"12%\"><a id=abtn2small href=\"allebilder.php?cam=$cam&datum=$gestern&linkvon=$datei&n=$n&m=$m\"><span id=span14>gestern</span></a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan=\"6\" id=tdbild>";
#Cam Bild
if($mode=="live") {
clearstatcache();
$bild = scandir_files_live($inc_pfad_www."live/",$cam);
$livebild="live/".$bild;
$livebildlink="live/".$bild;
$arg="&mode=live";
# bei nur Snapshot den letzten vom Snapshot nehmen
if($bild==""){
$letzte_jpg_heute=explode($inc_pfad_www, last_jpg_in_folder($inc_pfad_www.$heute."/".$cam."/"));
$livebildlink = $letzte_jpg_heute[1];
$livebild = $letzte_jpg_heute[1];
$arg="";
}
echo "<div id=divimg>";
#echo "<a href=\"einzelbild.php?bild=$livebildlink&cam=$cam&mode=live&linkvon=$datei\" title=\"".htmlentities("aktuelles Bild von ".$cam, ENT_QUOTES)."\">";
echo "<a href=\"einzelbild.php?bild=$livebildlink&cam=$cam".$arg."&linkvon=$datei&n=$n&m=$m\" title=\"".htmlentities("aktuelles Bild von ".$cam, ENT_QUOTES)."\">";
echo "<img id=imgindex src=\"".$livebild."\" style=\"width:".$inc_index_bild_breite."px;\">";
echo "</a>";
echo "</div>";
}else{
$letzte_jpg_heute=explode($inc_pfad_www, last_jpg_in_folder($inc_pfad_www.$heute."/".$cam."/"));
echo "<div id=divimg>";
echo "<a href=\"einzelbild.php?bild=$letzte_jpg_heute[1]&cam=$cam&linkvon=$datei&n=$n&m=$m\" title=\"".htmlentities("letztes Bild von ".$cam, ENT_QUOTES)."\">";
echo "<img id=imgindex src=\"".$letzte_jpg_heute[1]."\" style=\"width:".$inc_index_bild_breite."px;\">";
echo "</a>";
echo "</div>";
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</td>\n";
$l++;
$c++;
if( $c > $max_cam_pro_zeile ) echo "</tr>\n";
}
#echo "</tr>\n";
#echo "</table>\n";
# Ende Geruest
echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</body>\n";
echo "</html>\n";
# gibt pfad+dateiname der letzten jpg in dem ordner
function last_jpg_in_folder($d) {
$files = glob($d."*.jpg");
#$files = array_combine($files, array_map("filemtime", $files));
#arsort($files);
#$latest_file = key($files);
return end(array_values($files));
}
# gib array mit dateinamen zurück die sich im ordner befinden
function scandir_nofolders($d) {
return array_filter(scandir($d), function ($f) use($d) {
return ! is_dir($d . DIRECTORY_SEPARATOR . $f);
});
}
# gib array mit ordnernamen zurück die sich im ordner befinden
function scandir_folders($d) {
return array_filter(scandir($d), function ($f) use($d) {
return is_dir($d . DIRECTORY_SEPARATOR . $f);
});
}
# gib array mit ordnernamen zurück die sich im ordner befinden (. .. ausgeschlossen)
function scandir_folders_nopoint($d) {
return array_filter(scandir($d), function ($f) use($d) {
if($f == ".") return false;
elseif($f == "..") return false;
else return is_dir($d . DIRECTORY_SEPARATOR . $f);
});
}
# gib array mit ordnernamen zurück mit dem typ yyyy-mm-dd die sich im ordner befinden
function scandir_folders_yyyymmdd($d) {
return array_filter(scandir($d), function ($f) use($d) {
if( preg_match("/20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]/", $f) ) return is_dir($d . DIRECTORY_SEPARATOR . $f);
else return false;
});
}
function camampel($dir,$min) {
$sek = $min * 60;
$mydir = opendir($dir);
$gefunden="red";
while($file = readdir($mydir)) {
if($file != "." && $file != "..") {
if(!is_dir($dir.$file)) {
if(date("U",filemtime($dir.$file)) >= time() - $sek) $gefunden="green";
}
}
}
closedir($mydir);
return $gefunden;
}
# 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);
}
#
function scandir_files_live($d,$cam) {
$array = array_filter(scandir($d), function ($f) use($d,$cam) {
if($f == ".") return false;
elseif($f == "..") return false;
elseif( preg_match("/".$cam."_[0-9]+/", $f) and date("U",filemtime($d.$f)) >= time() - 3) return is_file($d . DIRECTORY_SEPARATOR . $f);
else return false;
});
$array = array_values($array);
return $array[count($array)-2];
}
#clearstatcache();
#$test = scandir_files_live($inc_pfad_www."live/","cam1");
?>

200
letztenbilder.php Executable file
View File

@@ -0,0 +1,200 @@
<?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);
}
?>

209
letztenbildermin.php Executable file
View File

@@ -0,0 +1,209 @@
<?php
# letztenbildermin.php
include('config.inc.php');
$datei = basename(__FILE__);
$min = isset($_GET['min']) ? $_GET['min'] : '';
$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");
$uhrzeit_vor_x = date("His",strtotime("-$min minutes"));
$soll=(integer)$uhrzeit_vor_x;
$bilder_array=jpg_in_folder($inc_pfad_www.$heute."/".$cam."/");
#Sort
if($inc_min_sort=="dsc"){
if($sort=="asc") asort($bilder_array,SORT_STRING); #ASC
else{
arsort($bilder_array,SORT_STRING); #DSC
$sort="dsc";
}
}elseif($inc_min_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_min_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\">";
echo "<img style=\"display:block;\" src=\"./$inc_logo\" width=\"$inc_logo_breite\"></a>";
echo "</td>";
# echo "<td align=\"right\"><a id=abtnback href=\"index.php\" title=\"\"><span>zur&uuml;ck</span></a></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>";
echo "<span style=\"font-size: 22px;\"><b>$cam</b></span>&nbsp;(&nbsp;";
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 "<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 $min min von heute: $bild</span></td>";
echo "</tr>\n";
echo "</table>\n";
$last="";
$g=0;
$td=0;
foreach($bilder_array AS $bilddateiname) {
$str=explode("/",strrev($bilddateiname));
$ist=(integer)substr(strrev($str[0]),0,2).substr(strrev($str[0]),3,2).substr(strrev($str[0]),6,2);
if($ist >= $soll) {
$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&min=$min&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);
}
# gibt pfad+dateiname der jpg in dem ordner
function jpg_in_folder($d) {
$files = glob($d."*.jpg");
return $files;
}
?>

259
popup.php Executable file
View File

@@ -0,0 +1,259 @@
<?php
$datei = basename(__FILE__);
$inc_pfad_www = "/var/www/motion/";
$inc_cams = array( "cam1" , "cam2", "cam3" );
#$inc_cams = array( "cam1" , "cam2" );
$inc_default_i = 5;
$inc_default_z = 10;
$inc_default_b = 300;
$inc_default_h = 350;
$inc_default_q = 90;
$array_aktiv = array();
$array_bild = array();
$array_uhrzeit = array();
# gibt pfad+dateiname der letzten jpg in dem ordner
function last_jpg_in_folder($d) {
$files = glob($d."*.jpg");
#$files = array_combine($files, array_map("filemtime", $files));
#arsort($files);
#$latest_file = key($files);
return end(array_values($files));
}
# skalierte jpg in popup ordner
function scaleimg($bild,$c,$b,$q,$u) {
$bild_src = imagecreatefromjpeg($bild);
$height = imagesy($bild_src);
$width = imagesx($bild_src);
$h = round($b/$width*$height);
$bild_neu = imagecreatetruecolor($b, $h);
imagecopyresampled($bild_neu, $bild_src, 0, 0, 0, 0, $b, $h, $width, $height);
#$bild_neu = imagescale ( $bild_src , $b ,-1 ,IMG_BICUBIC_FIXED);
imagejpeg( $bild_neu, "./popup/".$c."_".$b."_".$u.".jpg", $q );
imagedestroy($bild_neu);
imagedestroy($bild_src);
return true;
}
#include('config.inc.php');
$z = isset($_GET['z']) ? $_GET['z'] : $inc_default_z;
$i = isset($_GET['i']) ? $_GET['i'] : $inc_default_i;
$b = isset($_GET['b']) ? $_GET['b'] : $inc_default_b;
$h = isset($_GET['h']) ? $_GET['h'] : $inc_default_h;
$t = isset($_GET['t']) ? $_GET['t'] : '';
$vorhaltezeit = $z * 1000;
$bild_breite = $b;
$bild_hoehe = $h;
$heute = date("Y-m-d");
$jetzt = date("His");
$jetzt_lang = date("YmdHis");
#$jetzt_minus = date("His",strtotime("-10000 seconds"));
#$jetzt_minus = date("His",strtotime("-".$i." seconds"));
$jetzt_minus = date("His",strtotime("-".$z." seconds"));
#$aktiv1 = false;
#$aktiv2 = false;
$counter = 0;
foreach ($inc_cams as $cam) {
$letzte_jpg_heute = explode($inc_pfad_www, last_jpg_in_folder($inc_pfad_www.$heute."/".$cam."/"));
$bild = $letzte_jpg_heute[1];
preg_match('/[0-9]{2,2}-[0-9]{2,2}-[0-9]{2,2}-[0-9]{1,4}/',$bild, $treffer);
$HH = substr($treffer[0], 0, 2);
$MM = substr($treffer[0], 3, 2);
$SS = substr($treffer[0], 6, 2);
$bild_uhrzeit = $HH.$MM.$SS;
array_push($array_uhrzeit, $bild_uhrzeit);
if( $bild_uhrzeit >= $jetzt_minus ) array_push($array_aktiv, true);
else array_push($array_aktiv, false);
array_push( $array_bild, $bild );
scaleimg($bild,$cam,$b,$inc_default_q,$bild_uhrzeit);
#echo $bild."<br>";
$counter++;
}
#print_r($array_bild);echo "<br>";
#print_r($inc_cams);echo "<br>";
#print_r($array_uhrzeit);echo "<br>";
#print_r($array_aktiv);echo "<br>";
#echo $array_bild[0];
echo "<!DOCTYPE HTML>\n";
echo "<html>\n";
echo "<head>\n";
echo "<title>".htmlentities("Webcam Popup", ENT_QUOTES)."</title>\n";
#echo "<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">\n";
echo "<meta http-equiv=\"refresh\" content=\"$i;URL=./$datei?i=$i&z=$z&b=$b&h=$h\">\n";
echo "<script language=\"Javascript\">\n";
#echo "function moveWin() {\n";
#echo "myWindow.moveTo(500, 100);\n";
#echo "myWindow.focus();\n";
#echo "}\n";
#echo "function minimizeWin() {\n";
#echo "myWindow.moveTo(0, 0);\n";
#echo "myWindow.blur();\n";
#echo "}\n";
#echo "function closeWin() {\n";
#echo "var w = window.open('', 'myWindow');\n";
#echo "myWindow=window.open(\"\", \"myWindow\", \"width=800, height=400\");\n";
#echo "myWindow.document.close();\n";
#echo "myWindow.close();\n";
#echo "}\n";
echo "function openWin() {\n";
echo "myWindow=window.open(\"\", \"myWindow\", \"width=".($bild_breite+20).", height=".($bild_hoehe+20)."\");\n";
echo "myWindow.document.writeln(\"<!DOCTYPE HTML>\");\n";
echo "myWindow.document.writeln(\"<html>\");\n";
echo "myWindow.document.writeln(\"<head>\");\n";
echo "myWindow.document.writeln(\"<title>Kameras<\/title>\");\n";
echo "myWindow.document.writeln(\"<script language='Javascript'>\");\n";
echo "myWindow.document.writeln(\"setTimeout(function(){window.close()}, ".$vorhaltezeit.");\");\n";
echo "myWindow.document.writeln(\"<\/script>\");\n";
echo "myWindow.document.writeln(\"<\/head>\");\n";
echo "myWindow.document.writeln(\"<body>\");\n";
#echo "myWindow.document.writeln(\"".$jetzt."\");\n";
echo "myWindow.document.writeln(\"<table>\");\n";
for( $k=0 ; $k < count($inc_cams) ; $k++) {
#if($array_aktiv[$k]) echo "myWindow.document.writeln('<tr height=\"".round($bild_breite/4*3)."\"><td style=\"vertical-align:top\"><img src=\"".$array_bild[$k]."\" style=\"width:".$bild_breite."px;\"><\/td><\/tr>');\n";
if($array_aktiv[$k]) echo "myWindow.document.writeln('<tr height=\"".round($bild_breite/4*3)."\"><td style=\"vertical-align:top\"><img src=\"./popup/".$inc_cams[$k]."_".$b."_".$array_uhrzeit[$k].".jpg\" style=\"width:".$bild_breite."px;\"><\/td><\/tr>');\n";
else echo "myWindow.document.writeln('<tr height=\"".round($bild_breite/4*3)."\"><td>&nbsp;<\/td><\/tr>');\n";
}
echo "myWindow.document.writeln(\"<\/table>\");\n";
echo "myWindow.document.writeln(\"<\/body>\");\n";
echo "myWindow.document.writeln(\"<\/html>\");\n";
#echo "state = {'popupOpened' : true,'popupName' : 'myWindow'};";
echo "myWindow.document.close();\n";
echo "myWindow.moveTo(0, 0);\n";
#echo "myWindow.focus();\n";
echo "}\n";
#echo "function showValue1(newValue){\n";
#echo "document.getElementById(\"slide_refresh\").innerHTML=newValue;\n";
#echo "}\n";
#echo "function showValue2(newValue){\n";
#echo "document.getElementById(\"slide_vorhalte\").innerHTML=newValue;\n";
#echo "}\n";
#echo "function showValue1(newValue){\n";
#echo "document.getElementById(\"slide_refresh\").innerHTML=newValue;\n";
#echo "}\n";
#echo "function showValue2(newValue){\n";
#echo "document.getElementById(\"slide_vorhalte\").innerHTML=newValue;\n";
#echo "}\n";
echo "</script>\n";
echo "</head>\n";
# irgendwas aktiv?
if( in_array(true, $array_aktiv) ) echo "<body onload=\"openWin();\">\n";
else echo "<body>\n";
echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"5\">\n";
echo "<tr>\n";
echo "<td colspan=\"3\">\n";
echo "<span><b>Kamera Popup konfigurieren:</b></span>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<span>Intervall:</span>\n";
echo "</td>\n";
echo "<td>\n";
echo "<input type=\"range\" min=\"1\" max=\"20\" value=\"$i\" step=\"1\" onchange=\"location.href='$datei?b=$b&h=$h&z=$z&i='+this.value\" style=\"width: 300px;\">\n";
echo "</td>\n";
echo "<td>\n";
echo "<span id=\"slide_refresh\">$i Sek.</span>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<span>Vorhaltezeit:</span>\n";
echo "</td>\n";
echo "<td>\n";
echo "<input type=\"range\" min=\"1\" max=\"120\" value=\"$z\" step=\"1\" onchange=\"location.href='$datei?b=$b&h=$h&i=$i&z='+this.value\" style=\"width: 300px;\">\n";
echo "</td>\n";
echo "<td>\n";
echo "<span id=\"slide_vorhalte\">$z Sek.</span>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<span>Fensterbreite:</span>\n";
echo "</td>\n";
echo "<td>\n";
echo "<input type=\"range\" min=\"200\" max=\"600\" value=\"$b\" step=\"50\" onchange=\"location.href='$datei?z=$z&i=$i&h=$h&b='+this.value\" style=\"width: 300px;\">\n";
echo "</td>\n";
echo "<td>\n";
echo "<span id=\"slide_breite\">$b Pixel</span>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<span>Fensterh&ouml;he:</span>\n";
echo "</td>\n";
echo "<td>\n";
echo "<input type=\"range\" min=\"150\" max=\"1200\" value=\"$h\" step=\"50\" onchange=\"location.href='$datei?z=$z&i=$i&b=$b&h='+this.value\" style=\"width: 300px;\">\n";
echo "</td>\n";
echo "<td>\n";
echo "<span id=\"slide_hoehe\">$h Pixel</span>\n";
echo "</td>\n";
echo "</tr>\n";
#echo "<tr>\n";
#echo "<td>\n";
#echo "<button onclick=\"moveWin()\">Move</button>";
#echo "<button onclick=\"openWin()\">Open</button>";
#echo "<button onclick=\"minimizeWin()\">Minimize</button>";
#echo "<button onclick=\"closeWin()\">Close</button>";
echo "</table>\n";
echo "</body>\n";
echo "</html>\n";
?>

223
zoom.php Executable file
View File

@@ -0,0 +1,223 @@
<?php
# $datei
include('config.inc.php');
$datei = basename(__FILE__);
$heute = date("Y-m-d");
$URL=$_SERVER['REQUEST_URI'];
#echo $URL;
$bild = isset($_GET['bild']) ? $_GET['bild'] : '';
$linkvon = isset($_GET['linkvon']) ? $_GET['linkvon'] : 'index.php';
$cam = isset($_GET['cam']) ? $_GET['cam'] : '';
$anzahl = isset($_GET['anzahl']) ? $_GET['anzahl'] : '';
$min = isset($_GET['min']) ? $_GET['min'] : '';
$rotate = isset($_GET['rotate']) ? $_GET['rotate'] : '0';
$datum = isset($_GET['datum']) ? $_GET['datum'] : $heute;
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'motion';
$b = isset($_GET['b']) ? $_GET['b'] : '800';
$r = isset($_GET['r']) ? $_GET['r'] : '0';
if(!isset($breite) or $breite=="" or $breite < 300 or $breite > 2000 ) $breite=800;
if($linkvon!="index.php" and $linkvon!="allebilder.php" and $linkvon!="letztenbilder.php" and $linkvon!="letztenbildermin.php") $linkvon="index.php";
$bildplus="";
$bildminus="";
$bildplus2="";
$bildminus2="";
$bildplus3="";
$bildminus3="";
if($bild != "") {
$bilder_array=jpg_in_folder($inc_pfad_www.$datum."/".$cam."/");
asort($bilder_array,SORT_STRING);
$bildpos = array_search($inc_pfad_www.$bild, $bilder_array);
$bildcount = count($bilder_array);
if( $bildpos < ($bildcount-1) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-1]);
$bildplus=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+1]);
}
if( $bildpos >= 1 ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-1]);
$bildminus=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-1]);
}
if( $bildpos < ($bildcount-2) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-2]);
$bildplus2=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+2]);
}
if( $bildpos >= 2 ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-2]);
$bildminus2=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-2]);
}
if( $bildpos < ($bildcount-3) ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-3]);
$bildplus3=str_replace("$inc_pfad_www","",$bilder_array[$bildpos+3]);
}
if( $bildpos >= 3 ){
str_replace("$inc_pfad_www","",$bilder_array[$bildpos-3]);
$bildminus3=str_replace("$inc_pfad_www","",$bilder_array[$bildpos-3]);
}
}
#print_r($bilder_array);
$taste_bildminus="/motion/"."$datei?bild=$bildminus&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b";
$taste_bildplus="/motion/"."$datei?bild=$bildplus&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b";
$taste_bildminus3="/motion/"."$datei?bild=$bildminus3&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b";
$taste_bildplus3="/motion/"."$datei?bild=$bildplus3&cam=$cam&mode=$mode&r=$r&datum=$datum&anzahl=$anzahl&linkvon=$linkvon&b=$b";
$muster_datum = "/[0-9]{4}-[0-9]{2}-[0-9]{2}/";
$muster_uhrzeit = "/[0-9]{2}-[0-9]{2}-[0-9]{2}-/";
preg_match($muster_datum, $bild, $array_datum_bild);
preg_match($muster_uhrzeit, $bild, $array_uhrzeit_bild);
preg_match($muster_datum, $bildminus, $array_datum_bild_minus);
preg_match($muster_uhrzeit, $bildminus, $array_uhrzeit_bild_minus);
preg_match($muster_datum, $bildplus, $array_datum_bild_plus);
preg_match($muster_uhrzeit, $bildplus, $array_uhrzeit_bild_plus);
preg_match($muster_datum, $bildminus2, $array_datum_bild_minus2);
preg_match($muster_uhrzeit, $bildminus2, $array_uhrzeit_bild_minus2);
preg_match($muster_datum, $bildplus2, $array_datum_bild_plus2);
preg_match($muster_uhrzeit, $bildplus2, $array_uhrzeit_bild_plus2);
preg_match($muster_datum, $bildminus3, $array_datum_bild_minus3);
preg_match($muster_uhrzeit, $bildminus3, $array_uhrzeit_bild_minus3);
preg_match($muster_datum, $bildplus3, $array_datum_bild_plus3);
preg_match($muster_uhrzeit, $bildplus3, $array_uhrzeit_bild_plus3);
$datum_bild = $array_datum_bild[0];
$uhrzeit_bild = str_replace('-',':',rtrim($array_uhrzeit_bild[0],'-'));
$datum_bild_minus = $array_datum_bild_minus[0];
$uhrzeit_bild_minus = str_replace('-',':',rtrim($array_uhrzeit_bild_minus[0],'-'));
$datum_bild_minus2 = $array_datum_bild_minus2[0];
$uhrzeit_bild_minus2 = str_replace('-',':',rtrim($array_uhrzeit_bild_minus2[0],'-'));
$datum_bild_minus3 = $array_datum_bild_minus3[0];
$uhrzeit_bild_minus3 = str_replace('-',':',rtrim($array_uhrzeit_bild_minus3[0],'-'));
$datum_bild_plus = $array_datum_bild_plus[0];
$uhrzeit_bild_plus = str_replace('-',':',rtrim($array_uhrzeit_bild_plus[0],'-'));
$datum_bild_plus2 = $array_datum_bild_plus2[0];
$uhrzeit_bild_plus2 = str_replace('-',':',rtrim($array_uhrzeit_bild_plus2[0],'-'));
$datum_bild_plus3 = $array_datum_bild_plus3[0];
$uhrzeit_bild_plus3 = str_replace('-',':',rtrim($array_uhrzeit_bild_plus3[0],'-'));
echo "<!DOCTYPE HTML>\n";
echo "<html>\n";
echo "<head>\n";
echo "<title></title>\n";
if($mode=="live") $refresh=$inc_index_aktuell_refresh;
else $refresh=$inc_einzel_refresh;
echo "<meta http-equiv=\"refresh\" content=\"$refresh\">\n";
echo "<style type=\"text/css\">\n";
echo "body {\n";
echo " margin: 0;\n";
echo " padding: 0;\n";
echo "}\n";
echo "iframe {\n";
echo " display: block;\n";
echo " background: #000;\n";
echo " border: none;\n";
echo " height: 90vh;\n";
echo " width: 100vw;\n";
echo "}\n";
echo "</style>\n";
echo "</head>\n";
echo "<body>\n";
echo "<script language=\"Javascript\">\n";
echo "function rPressed() {\n";
if( $bildplus3!="" ) echo "window.location = '".$taste_bildplus3."';\n";
echo "}\n";
echo "function qPressed() {\n";
if( $bildminus3!="" ) echo "window.location = '".$taste_bildminus3."';\n";
echo "}\n";
echo "function wPressed() {\n";
if( $bildminus!="" ) echo "window.location = '".$taste_bildminus."';\n";
echo "}\n";
echo "function ePressed() {\n";
if( $bildplus!="" ) echo "window.location = '".$taste_bildplus."';\n";
echo "}\n";
echo "document.onkeydown = function(evt) {\n";
echo "evt = evt || window.event;\n";
echo "switch (evt.keyCode) {\n";
echo "case 81:\n";
echo "qPressed();\n";
echo "break;\n";
echo "case 82:\n";
echo "rPressed();\n";
echo "break;\n";
echo "case 69:\n";
echo "ePressed();\n";
echo "break;\n";
echo "case 87:\n";
echo "wPressed();\n";
echo "break;\n";
echo "}\n";
echo "};\n";
echo "</script>\n";
# outer Geruest
#echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
#echo "<tr>\n";
#echo "<td>\n";
if($b==400) $bold400="<b>400 Pixel</b>";
else $bold400="400 Pixel";
if($b==800) $bold800="<b>800 Pixel</b>";
else $bold800="800 Pixel";
if($b==1200) $bold1200="<b>1200 Pixel</b>";
else $bold1200="1200 Pixel";
if($b==1600) $bold1600="<b>1600 Pixel</b>";
else $bold1600="1600 Pixel";
echo "<iframe src=\"./2015-11-02/cam3/15-24-13-0001.jpg\" frameborder=\"0\"></iframe>\n";
# Ende Geruest
#echo "</td>";
#echo "</tr>";
#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;
}
function scandir_files_live($d,$cam) {
$array = array_filter(scandir($d), function ($f) use($d,$cam) {
if($f == ".") return false;
elseif($f == "..") return false;
elseif( preg_match("/".$cam."_[0-9]+/", $f) and date("U",filemtime($d.$f)) >= time() - 3) return is_file($d . DIRECTORY_SEPARATOR . $f);
else return false;
});
$array = array_values($array);
return $array[count($array)-2];
}
?>