diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-15 02:32:54 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-15 02:32:54 +0500 |
| commit | a3522672930578959980e39b7041b120c13cd6cf (patch) | |
| tree | 18925802226493d76e958e8e0e71f56cd3cf6671 /public/emotes | |
| parent | 2e84e2a301fe270f6911f597149cd88d9dc85abe (diff) | |
feat: show emote file sizes and dimensions
Diffstat (limited to 'public/emotes')
| -rw-r--r-- | public/emotes/index.php | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/public/emotes/index.php b/public/emotes/index.php index 78828e1..8706319 100644 --- a/public/emotes/index.php +++ b/public/emotes/index.php @@ -245,13 +245,32 @@ if (CLIENT_REQUIRES_JSON) { <?php if ($emote != null) { ?> <div class="box content"> - <div class="emote-showcase"> - <img src="/static/userdata/emotes/<?php echo $emote->get_id() ?>/1x.webp" - alt="<?php echo $emote->get_code() ?>"> - <img src="/static/userdata/emotes/<?php echo $emote->get_id() ?>/2x.webp" - alt="<?php echo $emote->get_code() ?>"> - <img src="/static/userdata/emotes/<?php echo $emote->get_id() ?>/3x.webp" - alt="<?php echo $emote->get_code() ?>"> + <div class="emote-showcase items-bottom"> + <?php + for ($size = 1; $size < 4; $size++) { + echo '<div class="column items-center small-gap">'; + + echo '<img src="/static/userdata/emotes/'; + echo $emote->get_id(); + echo "/{$size}x.webp\""; + echo 'title="' . $emote->get_code() . '" />'; + + $path = $_SERVER["DOCUMENT_ROOT"] . '/static/userdata/emotes/' . $emote->get_id() . "/{$size}x.webp"; + + echo '<div class="column items-center">'; + + if ($file_size = filesize($path)) { + $kb = sprintf("%.2f", $file_size / 1024); + echo "<p class='font-small'>{$kb}KB</p>"; + } + + if ($image_size = getimagesize($path)) { + echo "<p class='font-small'>$image_size[0]x$image_size[1]</p>"; + } + + echo '</div></div>'; + } + ?> </div> </div> </section> |
