ich habs mal bisschen umprogrammiert. vielleicht gefällts dir.
index.php:
Flughafen Dresden Webcam
html, body {
width: 100%;
height: 100%;
background-color:black;
}
html, body, h1, p {
margin:0;
padding:0;
}
#wrapper{
height: 100%;
width: 100%;
}
#picture {
height: 860px;
width: 1147px;
margin:0 auto;
background-color:black;
background-repeat: no-repeat;
}
#picture img{
display: none;
border:0;
}
#timewrapper {
width: 100%;
margin:0 auto;
background-color:black;
font:25px crystal;
color:#7fff00;
text-align:center;
}
#time, #reloadin{
display:inline-block;
width: 200px;
}
$(document).ready(function(){
var reloadTime = 3000;
var reloadIn = reloadTime;
$.getJSON('getData.php', function(data) {
loadPicture();
});
setInterval(function() {
loadPicture();
}, reloadTime);
setInterval(function() {
reloadIn -= 1000;
if(reloadIn == 0){
reloadIn = reloadTime;
}
$('#reloadin').html("Reload in "+reloadIn.toString().substr(0,1));
}, 1000);
function loadPicture(){
$.getJSON('getData.php', function(data) {
if(data.pic != $('#picture img').attr('src')){
$('#picture img').attr('src',data.pic);
$('#picture img').hide().fadeIn(600);
$('#time').html(data.day+'.'+data.month+'.'+data.year+' - '+data.hour+':'+data.minutes);
}
});
}
});
und getData.php:
<?php $zeitenliste = file('http://www.dresden-airport.de/img/drs/webcam/zeitenliste.txt');<br /> $date= trim($zeitenliste[0]);
$Bild = 'http://www.dresden-airport.de/img/drs/webcam/orig/'.trim($zeitenliste[0]).'.jpg';
$jahr=substr($date,0,4);
$monat=substr($date,4,2);
$tag=substr($date,6,2);
$st=substr($date,8,2);
$min=substr($date,10,2);
$sek=substr($date,12,2);
$arr = array('pic' =\> $Bild,'day' =\> $tag,'month' =\> $monat,'year' =\> $jahr, 'hour' =\> $st, 'minutes' =\> $min);
echo json\_encode($arr);
?\>
hf