comparison tools/makegmaps.php @ 323:a157aa18ec75 gmap2

get_resource_type() works differently in PHP 8, and it's not actually needed here anyway, so remove its use for compatibility.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 12 Mar 2023 14:58:12 +0200
parents 44e104b0ae90
children b0c2f11e60fa
comparison
equal deleted inserted replaced
322:a00a1507f4c4 323:a157aa18ec75
709 if (!$drawn) 709 if (!$drawn)
710 { 710 {
711 if ($zoom < 9) 711 if ($zoom < 9)
712 { 712 {
713 $im = imagecreate($tileDim, $tileDim); 713 $im = imagecreate($tileDim, $tileDim);
714 if ($im === false || get_resource_type($im) != "gd") 714 if ($im === false)
715 die("\nCould not create GD image resource open dim=".$tileDim. 715 die("\nCould not create GD image resource open dim=".$tileDim.
716 " for zoom=".$zoom.", continent=".$cname."\n"); 716 " for zoom=".$zoom.", continent=".$cname."\n");
717 717
718 $sea = imagecolorallocate($im, 51, 51, 170); 718 $sea = imagecolorallocate($im, 51, 51, 170);
719 imagefilledrectangle($im, 0, 0, $tileDim, $tileDim, $sea); 719 imagefilledrectangle($im, 0, 0, $tileDim, $tileDim, $sea);
722 { 722 {
723 $inFilename = $cfg["pathTileData"].$zoom."/sea.png"; 723 $inFilename = $cfg["pathTileData"].$zoom."/sea.png";
724 $im = imagecreatefrompng($inFilename); 724 $im = imagecreatefrompng($inFilename);
725 if ($im === false) 725 if ($im === false)
726 die("\nCould not open '".$inFilename."'.\n"); 726 die("\nCould not open '".$inFilename."'.\n");
727
728 if (get_resource_type($im) != "gd")
729 die("Not an GD image resource ".$im." in '".$inFilename."'\n");
730 } 727 }
731 } 728 }
732 729
733 $dx = $tileDim; 730 $dx = $tileDim;
734 $dy = $tileDim; 731 $dy = $tileDim;
803 foreach ($continentList as $cname => &$cdata) 800 foreach ($continentList as $cname => &$cdata)
804 if ($cdata[CTI_HAS_MAP] && $cdata[CTI_REG_CONT]) 801 if ($cdata[CTI_HAS_MAP] && $cdata[CTI_REG_CONT])
805 { 802 {
806 $mapFile = $cfg["pathImageCache"].$cname."_".$zoom2.".png"; 803 $mapFile = $cfg["pathImageCache"].$cname."_".$zoom2.".png";
807 $mapData[$cname] = imagecreatefrompng($mapFile); 804 $mapData[$cname] = imagecreatefrompng($mapFile);
808 if ($mapData[$cname] === FALSE || 805 if ($mapData[$cname] === false)
809 get_resource_type($mapData[$cname]) != "gd")
810 die("Not an GD image resource ".$mapData[$cname]." in '".$mapFile."'\n"); 806 die("Not an GD image resource ".$mapData[$cname]." in '".$mapFile."'\n");
811 807
812 $tmp = filemtime($mapFile); 808 $tmp = filemtime($mapFile);
813 if ($tmp > $mapMtime) 809 if ($tmp > $mapMtime)
814 $mapMtime = $tmp; 810 $mapMtime = $tmp;