forked from janfrl/dhbw-mehms-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
68 lines (56 loc) · 2.04 KB
/
index.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
68
<!DOCTYPE html>
<html lang="de">
<head>
<title>Home - DHBW Mehms</title>
<link rel="stylesheet" href="./styles/index.css">
<?php include("includes/meta.php"); ?>
</head>
<body>
<?php include("includes/header.php"); ?>
<main class="container">
<div class="toolbar-wrapper">
<div class="toolbar">
<svg xmlns="http://www.w3.org/2000/svg" class="i-search" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
</svg>
<form name="search" method="GET">
<input name="search" type="text" spellcheck="false" autocomplete="off" placeholder="Search Mehms">
</form>
</div>
</div>
<div id="gallery" class="gallery">
<?php $search = "";
if (isset($_GET['search'])) {
$search = $_GET['search'];
}
function ignoreCase($str)
{
$res = "";
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
$res = $res . "[" . strtolower($str[$i]) . strtoupper($str[$i]) . "]";
}
return $res;
}
$dirname = "./assets/mehms/";
$images = glob($dirname . "*" . ignoreCase($search) . "*");
foreach ($images as $image) {
$imageName = explode("/", $image);
$imageName = end($imageName);
if ($image != "./assets/mehms/rick.gif") {
$sizes = getimagesize($image);
try {
echo '<a class="mehm-card" style="width:' . $sizes[0] * 300 / $sizes[1] .
'px; flex-grow: ' . $sizes[0] * 300 / $sizes[1] . '"><div style="padding-top: ' .
$sizes[1] / $sizes[0] * 100 . '%"></div><img src="' . $image . '" loading="lazy" name="' . $imageName . '" /></a>';
} catch (DivisionByZeroError $e) {
}
}
} ?>
<div id="theater"></div>
</div>
</main>
<?php include("includes/footer.php"); ?>
<?php include("includes/bottom-navigation.php"); ?>
</body>
</html>