From 5e271907b35ef12b169b093a2f27d1a3e21bc5de Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 4 Jun 2022 08:24:59 -0700 Subject: [PATCH] fix error handling when there is a problem downloading a tile for #9 --- p3k/geo/StaticMap.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/p3k/geo/StaticMap.php b/p3k/geo/StaticMap.php index 4700565..3ca4621 100644 --- a/p3k/geo/StaticMap.php +++ b/p3k/geo/StaticMap.php @@ -352,9 +352,8 @@ function generate($params, $filename, $assetPath) { foreach($chs as $x=>$yTiles) { foreach($yTiles as $y=>$ch) { $content = curl_multi_getcontent($ch); - if($content) - $tiles[$x][$y] = @imagecreatefromstring($content); - else + $tiles[$x][$y] = @imagecreatefromstring($content); + if(!$tiles[$x][$y]) $tiles[$x][$y] = $blank; } } @@ -363,9 +362,8 @@ function generate($params, $filename, $assetPath) { foreach($ochs as $x=>$yTiles) { foreach($yTiles as $y=>$ch) { $content = curl_multi_getcontent($ch); - if($content) - $overlays[$x][$y] = @imagecreatefromstring($content); - else + $overlays[$x][$y] = @imagecreatefromstring($content); + if(!$overlays[$x][$y]) $overlays[$x][$y] = $blank; } }