-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgallery.php
39 lines (39 loc) · 1.05 KB
/
gallery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<head>
<title>Gallery test</title>
<script type='text/javascript' src='javascripts/jquery-1.8.2.min.js'></script>
<script type='text/javascript' src='javascripts/jquery.justifiedgallery.js'></script>
</head>
<link href="front.css" media="screen, projection" rel="stylesheet" type="text/css">
<link rel='stylesheet' href="css/jquery.justifiedgallery.css" type='text/css' media='all' />
<body>
<div class="gallery">
<?php
function getExtension($file){
$info = pathinfo($file);
return $info['extension'];
}
function getImages($dir){
$images[]=NULL;
$i = 0;
if(false != ($handle = opendir($dir))){
while( false!= ($file = readdir($handle))){
$type = getExtension($file);
if($type == "jpg" || $type == 'jpeg'){
$images[$i] ="./usrimages/".$file;
$i++;
}
}
}
return $images;
}
foreach(getImages("./usrimages") as $image){
echo "<a href=\"".$image."\" title=\"test\">";
echo "<img alt=\"!!!!!!!!!!!!!!!!!!!!\", src=\"".$image."\"/>";
echo "</a>\n";
}
?>
</div>
<script type="text/javascript">
$(".gallery").justifiedGallery();
</script>
</body>