-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
81 lines (79 loc) · 2.2 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
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
$imagesDir = './images/';
$metadataDir = './metadata/';
$safetensorsDir = './safetensors/';
$images = glob($imagesDir . '*.png');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>EasyLoraWebShop</title>
<style>
body {
background-color: #333;
color: #fff;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
padding: 20px;
}
.item {
display: flex;
flex-direction: column;
align-items: center;
background-color: #222;
border-radius: 10px;
padding: 10px;
text-align: center;
}
img {
max-width: 100%;
border-radius: 5px;
cursor: pointer;
}
.name, .download {
margin-top: 10px;
}
a {
color: #4aa;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.refresh-button {
position: absolute;
top: 10px;
left: 10px;
color: #4aa;
cursor: pointer;
}
</style>
</head>
<body>
<a class="refresh-button" href="./create_meta.php" target="_blank">Refresh metadata</a>
<div class="gallery">
<?php foreach ($images as $image):
$baseName = basename($image, '.png');
$infoLink = "./info.php?modelname=" . urlencode($baseName);
$safetensorFile = $safetensorsDir . $baseName . '.safetensors';
?>
<div class="item">
<a href="<?= htmlspecialchars($infoLink) ?>" target="_blank">
<img src="<?= htmlspecialchars($image) ?>" alt="<?= htmlspecialchars($baseName) ?>">
</a>
<div class="name"><?= htmlspecialchars($baseName) ?></div>
<div class="download">
<a href="<?= htmlspecialchars($safetensorFile) ?>" download="<?= htmlspecialchars($baseName) ?>.safetensors">Download Safetensor</a>
</div>
</div>
<?php endforeach; ?>
</div>
</body>
</html>