-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvenn-library.php
More file actions
46 lines (42 loc) · 1.42 KB
/
venn-library.php
File metadata and controls
46 lines (42 loc) · 1.42 KB
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
<?php $page_name = 'library' ?>
<?php include 'includes/head.php';?>
<?php
$dir = "diagrams_thumb/diagrams";
$good_ext = array( ".png");
$files = array();
if ( $handle = opendir( $dir ) ) {
while ( false!== ( $file = readdir( $handle ) ) ) {
$ext = strrchr( $file, "." );
if ( in_array( $ext, $good_ext ) ) {
$d = filemtime($dir.'/'.$file);
$files[$d] = $file;
}
}
closedir( $handle );
// sort
krsort($files);
// counter
$count = 0;
$file_count = count($files);
// loop through the directory
echo '<div class="container library oh"><div class="row mt3">';
foreach($files as $file) {
if ($count == 0) {
echo '<div class="col col-6 center thumbnail"><a class="block" href="venn-single.php?venn=diagrams/'.$file.'"><img src="'.$dir.'/'.$file.'" /></a></div>';
} else if ($count == $file_count - 1) {
echo '</div>';
} else if ($count % 2 == 0) {
echo '</div><div class="row">';
echo '<div class="col col-6 center thumbnail"><a class="block" href="venn-single.php?venn=diagrams/'.$file.'"><img src="'.$dir.'/'.$file.'" /></a></div>';
} else {
echo '<div class="col col-6 center thumbnail"><a class="block" href="venn-single.php?venn=diagrams/'.$file.'"><img src="'.$dir.'/'.$file.'" /></a></div>';
}
$count++;
}
echo '</div></div>';
}
else {
echo "Directory does not exist!";
}
?>
<?php include 'includes/foot.php';?>