summaryrefslogtreecommitdiff
path: root/public/catalogue.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/catalogue.php')
-rw-r--r--public/catalogue.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/public/catalogue.php b/public/catalogue.php
index fca1183..9836cbf 100644
--- a/public/catalogue.php
+++ b/public/catalogue.php
@@ -35,6 +35,17 @@ $stmt = $db->query("SELECT f.id, f.mime, f.extension
$stmt->execute();
$files = $stmt->fetchAll();
+
+foreach ($files as &$f) {
+ if (str_starts_with($f['mime'], 'video/')) {
+ $f['color'] = 'blue';
+ } else if ($f['mime'] == 'application/x-shockwave-flash') {
+ $f['color'] = 'red';
+ }
+
+ $f['thumb_title'] = "{$f['mime']} ({$f['extension']})";
+}
+unset($f);
?>
<!DOCTYPE html>
<html>
@@ -63,16 +74,16 @@ $files = $stmt->fetchAll();
<section class="wall">
<?php foreach ($files as $file): ?>
- <div class="brick">
+ <div class="brick<?= isset($file['color']) ? " {$file['color']}" : '' ?>">
<a href="/<?= sprintf('%s.%s', $file['id'], $file['extension']) ?>">
- <i>
+ <i title="<?= $file['thumb_title'] ?>">
<?php if (str_starts_with($file['mime'], 'image/') || str_starts_with($file['mime'], 'video/')): ?>
<img src="<?= sprintf('%s/%s.webp', FILE_THUMBNAIL_DIRECTORY_PREFIX, $file['id']) ?>"
- alt="No thumbnail.">
+ alt="No thumbnail." loading="lazy">
<?php elseif (str_starts_with($file['mime'], 'audio/')): ?>
- <img src="/static/img/icons/file_audio.png" alt="No thumbnail.">
+ <img src="/static/img/icons/file_audio.png" alt="No thumbnail." loading="lazy">
<?php elseif (str_starts_with($file['mime'], 'text/')): ?>
- <img src="/static/img/icons/file_text.png" alt="No thumbnail.">
+ <img src="/static/img/icons/file_text.png" alt="No thumbnail." loading="lazy">
<?php else: ?>
<img src="/static/img/icons/file.png" alt="No thumbnail.">
<?php endif; ?>