-
Notifications
You must be signed in to change notification settings - Fork 0
/
pictures.php
67 lines (43 loc) · 993 Bytes
/
pictures.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
$basedir = "photos";
$cats = [];
$imgs = [];
$subpaths = glob($basedir . '/*' , GLOB_ONLYDIR);
natsort($subpaths);
foreach($subpaths as $subpath) {
$dir = explode('/', $subpath);
$subdir = $dir[1];
#print_r($subdir);
if ($subdir=="_thumbnails"){continue;}
$cats[] = $subdir;
$images = glob($subpath . "/*.[jJ][pP][gG]");
# $imgs = '';
foreach($images as $image){
$imgs[] = ["$image", basename($image), $subpath, $subdir];
}
}
#print_r($imgs);
?>
<article>
<h1>Pictures</h1>
<ul>
<?php
foreach ($cats as $cat) {
print "<li><a href='#$cat'>$cat</a></li>";
}
print "</ul>";
foreach ($cats as $cat) {
print "<h2 id='$cat'>$cat</h2>";
foreach ($imgs as $img_d) {
if ($cat==$img_d[3]) {
echo "
<p>
<a href='{$img_d[0]}'>
<img src='{$basedir}/_thumbnails/" . $img_d[1] ."' height='200' alt='conference image'/>
</a>
</p>";
}
}
}
?>
</article>