< >

bilder-ordner-auslesen-links-und-groese.php


Quell Code


 <style>
#slides{
    margin-top:50px;
    margin-left:10px;
}
#online{
        position:fixed;
        top:0px;
        left:0px;
        z-index:1;
        width:350px;
        height:50px;
        font-size:16px;
        font-weight:900;
        color:white;
}
</style>
<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
<style type="text/css">
ul#galerie {
position:fixed;
top:0;
left:0;
z-index:2;
 padding:0;
 margin:0;
 list-style-type:none;
 font-family:Arial, Helvetica, sans-serif;
}
ul#galerie li{
 padding: 3px;
 background-color:#ebebeb;
 border:1px solid #CCC;
 float:left;
 margin:0 10px 10px 0; 
}
ul#galerie li:hover{
 border:1px solid #333;
}
ul#galerie li span{
 display:block;
 text-align:center;
 font-size:10px;
}
ul#galerie li a img{
 border:none;
}
</style>
<body>
<ul id="galerie">
<?php
$ordner = "../../bilder/";  
$allebilder = scandir($ordner);  
foreach ($allebilder as $bild) {
$bildinfo = pathinfo($ordner."/".$bild); 
$size = ceil(filesize($ordner."/".$bild)/1024); 
if ($bild != "." && $bild != ".."  && $bild != "_notes" && $bildinfo['basename'] != "Thumbs.db") { 
?>
<li>
<a href="<?php echo $bildinfo['dirname']."/".$bildinfo['basename'];?>">
<img src="<?php echo $bildinfo['dirname']."/".$bildinfo['basename'];?>" width="30" alt="Vorschau" /></a> 
<span title="<?php echo $bildinfo['filename']; ?> (<?php echo $size ; ?>kb)"></span>
</li>
<?php
};
};
?>
</ul>
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$images = glob("../../bilder/*.jpg");
$imjson = json_encode($images);
?>
<div id="slides"></div> 
<div id="online">
<p id="ordner"></p>
<p id="aktu"></p></div>
<script>
var images = <?php echo $imjson; ?>;
for(a=0;a<=images.length-1;a++){
    document.getElementById('slides').innerHTML+='<a href="'+images[a]+'">'+images[a]+'</a><br>';
}

var saven;
y=0;
var seite1='../../bilder/';
$.ajax({
        url: seite1,
        type: 'GET',
        success: function(data) {
            try{
                var ol=data.split('Parent Directory</a>')[1].split('</pre')[0];
                var bild=ol.split('<a href="');
                for(a=1;a<=bild.length-1;a++){
                     g=ol.split('href="')[a].split('"')[0];
                   
                     f=Math.round(a-1);
                     localStorage.setItem('link'+f,g)
                    // href_back=[g]
               }
                document.getElementById('ordner').innerHTML='<p>'+Math.round(bild.length-1)+' Bilder gefunden</p>';
            }catch(e){
                document.getElementById('ordner').innerHTML='<p style="font-size:25px;color:red">Error</p>';
            }
		function los(){
        y++;
         if(y< bild.length){
         $('body').css('backgroundImage','url("./bilder/'+localStorage.getItem('link'+y)+'")');
         $('body').css('backgroundSize','cover');
         $('body').css('backgroundRepeat','no-repeat');
         $('body').css('backgroundPosition','center center');
          $('body').css('maxWidth','100%');
           document.getElementById('aktu').innerHTML='Aktuell: '+y;
            //  slides.getElementsByTagName("div")[0].innerHTML +="<div><img src="+localStorage.getItem('link'+y)+"></div>"
           }
           if(y==bild.length){
     
              y=0;
           }else{
           }
            setTimeout(function(){los()},5000);
		}
 los()
}});

    </script>
</body>

Add Comment

* Required information
1000
Powered by Commentics

Comments (1)

Gravatar
Admin
Sascha65says...

Die Canvas Balken Uhr ist ja mal Fett