diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-11 16:52:46 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-11 16:56:01 +0500 |
| commit | f2690a42235297c357bcd8abbf6e194db7b7bd57 (patch) | |
| tree | 1b0a221cd89903ed901b1d28047a493fa4a1317c /src | |
| parent | 7d0b7ed296d35025e04e19dc2604c8feca72383e (diff) | |
feat: store original uploads
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.sample.php | 1 | ||||
| -rw-r--r-- | src/images.php | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/config.sample.php b/src/config.sample.php index 9a50d2d..6998835 100644 --- a/src/config.sample.php +++ b/src/config.sample.php @@ -28,6 +28,7 @@ define("EMOTE_COMMENT_MAX_LENGTH", 100); // Max length for emote comment. define("EMOTE_VISIBILITY_DEFAULT", 2); // Default visibility for emotes. 0 - unlisted, 1 - public, 2 - pending approval (same as unlisted). define("EMOTE_MAX_SIZE", [128, 128]); // Max size of emote. define("EMOTE_NAME_REGEX", "/^[A-Za-z0-9_]+$/"); // RegEx filter for emote names. +define("EMOTE_STORE_ORIGINAL", true); // Store original uploads of emotes. // EMOTESETS define("EMOTESET_PUBLIC_LIST", true); // Show emotesets public. diff --git a/src/images.php b/src/images.php index a9caf88..837ebaf 100644 --- a/src/images.php +++ b/src/images.php @@ -29,6 +29,15 @@ function resize_image(string $src_path, string $dst_path, int $max_width, int $m return $result_code; } +function get_file_extension(string $path): string|null +{ + if ($file = getimagesize($path)) { + return image_type_to_extension(intval($file[2]), false); + } + + return null; +} + function does_file_meet_requirements(string $path, int $max_width, int $max_height): array { $file = getimagesize($path); |
