From d7973f5dd033359b77015b67b7a81c595b3180e4 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 7 May 2025 03:20:20 +0500 Subject: feat: manual emote resize --- src/images.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 -- cgit v1.2.3