diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-03 16:50:50 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-03 16:50:50 +0500 |
| commit | 2c51a000a9f2f51f54b761e4975086f9db3780a4 (patch) | |
| tree | 6fbe2871a652cf3264cfd42fede1d6369cefca84 /src | |
| parent | a196b0bdf3d7dd4a86c4bf0bc5d5065ac03cd268 (diff) | |
upd: big changes in database.sql + .webp is now default image format
Diffstat (limited to 'src')
| -rw-r--r-- | src/emote.php | 15 | ||||
| -rw-r--r-- | src/images.php | 2 | ||||
| -rw-r--r-- | src/user.php | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/emote.php b/src/emote.php index 769d62a..ea9e52c 100644 --- a/src/emote.php +++ b/src/emote.php @@ -65,7 +65,7 @@ class Emote function html_random_emote(PDO &$db) { - $stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 AND is_featured = false ORDER BY RAND() LIMIT 1"); + $stmt = $db->prepare("SELECT id, code FROM emotes WHERE visibility = 1 ORDER BY RAND() LIMIT 1"); $stmt->execute(); if ($row = $stmt->fetch()) { @@ -77,8 +77,8 @@ function html_random_emote(PDO &$db) </div> <div class="box content center"> <a href="/emotes?id=<?php echo $row["id"] ?>"> - <img src="/static/userdata/emotes/<?php echo $row["id"] . '/3x.' . $row["ext"] ?>" - alt="<?php echo $row["code"] ?>" width="192"> + <img src="/static/userdata/emotes/<?php echo $row["id"] ?>/3x.webp" alt="<?php echo $row["code"] ?>" + width="192"> </a> </div> </section> @@ -89,7 +89,10 @@ function html_random_emote(PDO &$db) function html_featured_emote(PDO &$db) { - $stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 AND is_featured = true ORDER BY updated_at DESC LIMIT 1"); + $stmt = $db->prepare("SELECT e.id, e.code FROM emotes e + INNER JOIN emote_sets es ON es.is_featured = TRUE + INNER JOIN emote_set_contents esc ON es.id = esc.emote_set_id + WHERE e.visibility = 1 AND e.id = esc.emote_id ORDER BY esc.added_at DESC LIMIT 1"); $stmt->execute(); if ($row = $stmt->fetch()) { @@ -101,8 +104,8 @@ function html_featured_emote(PDO &$db) </div> <div class="box content center"> <a href="/emotes?id=<?php echo $row["id"] ?>"> - <img src="/static/userdata/emotes/<?php echo $row["id"] . '/3x.' . $row["ext"] ?>" - alt="<?php echo $row["code"] ?>" width="192"> + <img src="/static/userdata/emotes/<?php echo $row["id"] ?>/3x.webp" alt="<?php echo $row["code"] ?>" + width="192"> </a> </div> </section> diff --git a/src/images.php b/src/images.php index d57794f..6ce8b5a 100644 --- a/src/images.php +++ b/src/images.php @@ -12,7 +12,7 @@ function resize_image(string $src_path, string $dst_path, int $max_width, int $m $imagick = new Imagick(); $imagick->readImage($src_path); - $format = "." . strtolower($imagick->getImageFormat()); + $format = ".webp"; if (!$set_format) { $format = ""; diff --git a/src/user.php b/src/user.php index c09c5d5..e9fec0b 100644 --- a/src/user.php +++ b/src/user.php @@ -1,7 +1,7 @@ <?php class User { - private int $id; + private string $id; private string $username; private int $joined_at; private int $last_active_at; |
