Kaynağa Gözat

fix google cse crash

lolcat 2 hafta önce
ebeveyn
işleme
e1d0ab121f
1 değiştirilmiş dosya ile 17 ekleme ve 8 silme
  1. 17 8
      scraper/google_cse.php

+ 17 - 8
scraper/google_cse.php

@@ -725,18 +725,27 @@ class google_cse{
 				// calculate rounded ratio
 				// calculate rounded ratio
 				if($found_size){
 				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";
 						$thumb["ratio"] = "1:1";
 					}else{
 					}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";
+						}
 					}
 					}
 				}
 				}
 			}
 			}