diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-07 03:20:20 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-07 03:20:20 +0500 |
| commit | d7973f5dd033359b77015b67b7a81c595b3180e4 (patch) | |
| tree | 368e7545cb1a874e9ebd48c5827029be3b40e3d9 /src/images.php | |
| parent | 643fccf82f1ab35565172f6bbe7b001927d71775 (diff) | |
feat: manual emote resize
Diffstat (limited to 'src/images.php')
| -rw-r--r-- | src/images.php | 10 |
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 |
