-
Notifications
You must be signed in to change notification settings - Fork 1
/
images.php
44 lines (35 loc) · 1.43 KB
/
images.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
<!DOCTYPE HTML>
<html lang="en">
<head>
<?php include 'common/head.php'; ?>
</head>
<body>
<?php
include 'common/header.php';
include 'common/loggedIn.php';
?>
<div class="images container">
<div class="imageList">
<?php
if($username) {
$dir = new DirectoryIterator($username);
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$fileName = $fileinfo->getFilename();
// maks sure it's not one of our sized images or a php file. If that's the case, it means it's an image
// as there is no other way to get a file in here
if (!preg_match('/-t\.|-s\.|-m\.|-l\.|\.php/', $fileName)) {
$justFileName = pathinfo($fileName, PATHINFO_FILENAME);
$extension = pathinfo($fileName, PATHINFO_EXTENSION);
echo '<div class="imageListItem"><a class="imageLink" href="image.php?i=' . urlencode($username) . '/'. urlencode($fileName) . '"><div class="imageBlock" style="background-image: url(\'/img/' . $username . '/'. $justFileName . '-s.' . $extension . '\');"></div></a></div>';
}
}
}
} else {
echo $loginMessage;
}
?>
</div>
</div>
</body>
</html>