From e1d0ab121fa8ae394fac4901b982c2617a2492da Mon Sep 17 00:00:00 2001 From: lolcat Date: Sat, 24 Oct 2026 03:24:52 -0400 Subject: [PATCH] fix google cse crash --- scraper/google_cse.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scraper/google_cse.php b/scraper/google_cse.php index 8576f96..5f01109 100644 --- a/scraper/google_cse.php +++ b/scraper/google_cse.php @@ -725,18 +725,27 @@ class google_cse{ // calculate rounded ratio if($found_size){ - $aspect_ratio = $width / $height; - - if($aspect_ratio >= 1.5){ - - $thumb["ratio"] = "16:9"; - } - elseif($aspect_ratio >= 0.8){ + if( + $width === 0 || + $height === 0 + ){ $thumb["ratio"] = "1:1"; }else{ - $thumb["ratio"] = "9:16"; + $aspect_ratio = $width / $height; + + if($aspect_ratio >= 1.5){ + + $thumb["ratio"] = "16:9"; + } + elseif($aspect_ratio >= 0.8){ + + $thumb["ratio"] = "1:1"; + }else{ + + $thumb["ratio"] = "9:16"; + } } } }