Skip to content

Instantly share code, notes, and snippets.

@steffengrahl
Last active July 11, 2017 17:01
Show Gist options
  • Save steffengrahl/c7977c0ed335674e3026188f8a49f4e2 to your computer and use it in GitHub Desktop.
Save steffengrahl/c7977c0ed335674e3026188f8a49f4e2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP - Ordner auslesen und anzeigen</title>
<style type="text/css">
ul#galerie {
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>
<!-- include jQuery library -->
<script type="text/javascript" src="http://ajax.googleapis.com/.../jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery-lightbox/js/jquery.lightbox-0.5.js"></script>
<link href="jquery-lightbox/css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
$(document).ready(function() {
$('#galerie a').lightBox();
});
</script>
</head>
<body>
<ul id="galerie">
<?php
$ordner = "images";
$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"
&& $bildinfo['basename'] != ".DS_Store" ) {
?>
<li>
<a href="<?php echo $bildinfo['dirname'] . "/" . $bildinfo['basename']; ?>">
<img src="<?php echo $bildinfo['dirname'] . "/" . $bildinfo['basename']; ?>" width="140" alt="<?php echo $bildinfo['filename']; ?>">
</a>
<span>
<?php echo $bildinfo['filename']; ?> (<?php echo $size; ?>kb)
</span>
</li>
<?php
};
};
?>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment