Skip to content

Instantly share code, notes, and snippets.

@casspangell
Created January 4, 2011 22:49
Show Gist options
  • Save casspangell/765602 to your computer and use it in GitHub Desktop.
Save casspangell/765602 to your computer and use it in GitHub Desktop.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="language" content="en" />
<title>Gallery</title>
<!--JQUERY-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!--LIGHTBOX STUFF-->
<script type="text/javascript" src="http://leandrovieira.com/projects/jquery/lightbox/js/jquery.lightbox-0.4.js"></script>
<link rel="stylesheet" type="text/css" href="http://leandrovieira.com/projects/jquery/lightbox/css/jquery.lightbox-0.4.css" media="screen" />
<script type="text/javascript">
$('#photos a').lightBox({fixedNavigation:true});
</script>
</head>
<body align="center" >
<div id="photos">
<?php
$arr = array();
if ($handle = opendir('gallery')) {
// echo "Directory handle: $handle\n";
//echo "Files:\n";
while (false !== ($file = readdir($handle))) {
if(strlen($file) < 5){
//skip random missing filenames
}else{
$arr[] = ($file);
}
}
closedir($handle);
}
//print_r($arr);
//header('Content-Type: image/jpeg');
echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
echo " images: [\n";
foreach ($arr as $value) {
// echo "<br />Value: $value\n length: ", strlen($value);
$imagepath = "gallery/" . $value;
echo $imagepath;
?>
<img src=<?php echo "\"$imagepath\"" ?> width="20" height="20"/><br />
<?php
}
?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment