summaryrefslogtreecommitdiff
path: root/src/images.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/images.php')
-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