summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-05-07 03:20:20 +0500
committerilotterytea <iltsu@alright.party>2025-05-07 03:20:20 +0500
commitd7973f5dd033359b77015b67b7a81c595b3180e4 (patch)
tree368e7545cb1a874e9ebd48c5827029be3b40e3d9 /src
parent643fccf82f1ab35565172f6bbe7b001927d71775 (diff)
feat: manual emote resize
Diffstat (limited to 'src')
-rw-r--r--src/images.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/images.php b/src/images.php
index 9a2c2a5..88db094 100644
--- a/src/images.php
+++ b/src/images.php
@@ -27,4 +27,14 @@ function resize_image(string $src_path, string $dst_path, int $max_width, int $m
exec(command: "magick convert $input_path -coalesce -resize {$new_width}x$new_height -layers optimize -loop 0 $output_path", result_code: $result_code);
return $result_code;
+}
+
+function does_file_meet_requirements(string $path, int $max_width, int $max_height): array
+{
+ $file = getimagesize($path);
+ if (!$file) {
+ return [false, null];
+ }
+
+ return [$file[0] <= $max_width && $file[1] <= $max_height, image_type_to_extension(intval($file[2]), false)];
} \ No newline at end of file