From c5b4dda9507dc0b2fa19b090d94f5d5653ad7490 Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Sat, 18 Nov 2023 16:42:33 +0800 Subject: [PATCH] Detect errors from resize-img using substr_count() --- php/get.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/php/get.php b/php/get.php index d2a9584..4b573d3 100644 --- a/php/get.php +++ b/php/get.php @@ -86,8 +86,9 @@ function create_thumbnail(string $category, string $file): string | null { log_print("generating thumbnail for $original_file"); $output = shell_exec(THUMBNAIL_SCRIPT." '$original_file' '$thumbnail_file' 2>&1"); if ($output) log_print($output); - if ($output === false) { + if (substr_count(strtolower((string) $output), "error")) { log_error("Thumbnail failed"); + log_print(ROOT_URL.IMG_DIR.$path); return ROOT_URL.IMG_DIR.$path; }