From 70310678444a43c1ef3f460d9761ad0c2818f001 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 15 Jun 2025 17:09:08 +0400 Subject: feat: thumbnails for audio, text and other files --- public/index.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'public/index.php') diff --git a/public/index.php b/public/index.php index 4186399..9a0e293 100644 --- a/public/index.php +++ b/public/index.php @@ -539,6 +539,20 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); file_deletion = ``; } + + let thumbnailPath = `/${file.id}.webp`; + let thumbnailSize = "width: 64px; height: 64px;"; + if (file.mime.startsWith('audio/')) { + thumbnailPath = '/static/img/icons/file_audio.png'; + } else if (file.mime.startsWith('text/')) { + thumbnailPath = '/static/img/icons/file_text.png'; + } else if (!file.mime.startsWith('image/') && !file.mime.startsWith('video/')) { + thumbnailPath = '/static/img/icons/file.png'; + } else { + thumbnailSize = 'max-width:100%; max-height: 100%;'; + } + + return `
-
-

No thumbnail.

+
+

No thumbnail.

-- cgit v1.2.3