# HG changeset patch # User Matti Hamalainen # Date 1429210635 -10800 # Node ID 0374836ed73a97dc396fa2c3c0c59117d89b7a49 # Parent 2233bdad4ab502a374ca6d7700010894439a2938 Various fixes in the image data handling. diff -r 2233bdad4ab5 -r 0374836ed73a tools/makegmaps.php --- a/tools/makegmaps.php Thu Apr 16 21:04:35 2015 +0300 +++ b/tools/makegmaps.php Thu Apr 16 21:57:15 2015 +0300 @@ -683,16 +683,23 @@ { if ($zoom < 9) { - $im = @imagecreate($tileDim, $tileDim); + $im = imagecreate($tileDim, $tileDim); + if ($im === false || get_resource_type($im) != "gd") + die("\nCould not create GD image resource open dim=".$tileDim. + " for zoom=".$zoom.", continent=".$continent."\n"); + $sea = imagecolorallocate($im, 51, 51, 170); imagefilledrectangle($im, 0, 0, $tileDim, $tileDim, $sea); } else { $inFilename = $cfg["pathTileData"].$zoom."/sea.png"; - $im = @imagecreatefrompng($inFilename); + $im = imagecreatefrompng($inFilename); if ($im === false) die("\nCould not open '".$inFilename."'.\n"); + + if (get_resource_type($im) != "gd") + die("Not an GD image resource ".$im." in '".$inFilename."'\n"); } } @@ -766,11 +773,15 @@ $mh = ceil( $worldMap["h"] * $scale); $mapMtime = -1; - foreach ($continentList as $continent => $data) + foreach ($continentList as $continent => &$data) if ($data[4] && $data[7]) { $mapFile = $cfg["pathImageCache"].$continent."_".$zoom2.".png"; - $mapData[$continent] = @imagecreatefrompng($mapFile); + $mapData[$continent] = imagecreatefrompng($mapFile); + if ($mapData[$continent] === FALSE || + get_resource_type($mapData[$continent]) != "gd") + die("Not an GD image resource ".$mapData[$continent]." in '".$mapFile."'\n"); + $tmp = filemtime($mapFile); if ($tmp > $mapMtime) $mapMtime = $tmp;