From 2c51a000a9f2f51f54b761e4975086f9db3780a4 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 3 May 2025 16:50:50 +0500 Subject: upd: big changes in database.sql + .webp is now default image format --- src/emote.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/emote.php') 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)
"> - " - alt="" width="192"> + /3x.webp" alt="" + width="192">
@@ -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)
"> - " - alt="" width="192"> + /3x.webp" alt="" + width="192">
-- cgit v1.2.3