diff options
Diffstat (limited to 'public/emotes')
| -rw-r--r-- | public/emotes/index.php | 8 | ||||
| -rw-r--r-- | public/emotes/upload.php | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/public/emotes/index.php b/public/emotes/index.php index e9e93cb..811ada2 100644 --- a/public/emotes/index.php +++ b/public/emotes/index.php @@ -195,6 +195,14 @@ if (CLIENT_REQUIRES_JSON) { echo "Emote - " . $emote->get_code(); echo '<div class="row small-gap" style="margin-left:auto">'; + $original_path = "/static/userdata/emotes/" . $emote->get_id(); + $files = glob($_SERVER["DOCUMENT_ROOT"] . $original_path . "/original.*"); + + if (!empty($files)) { + $filename = basename($files[0]); + echo "<a href='$original_path/$filename' target='_BLANK'><img src='/static/img/icons/emotes/emote.png' alt='[Show original]' title='Show original' /></a>"; + } + $stmt = $db->prepare(" SELECT MAX(es.is_featured) AS is_featured, MAX(es.is_global) AS is_global FROM emote_sets es diff --git a/public/emotes/upload.php b/public/emotes/upload.php index f890ec2..8b197a2 100644 --- a/public/emotes/upload.php +++ b/public/emotes/upload.php @@ -387,6 +387,11 @@ if ($is_manual) { abort_upload($path, $db, $id); exit; } + + if (EMOTE_STORE_ORIGINAL) { + $ext = get_file_extension($image["tmp_name"]) ?? ""; + move_uploaded_file($image["tmp_name"], "$path/original.$ext"); + } } if (ACCOUNT_LOG_ACTIONS) { |
