Nome do arquivo map (deve estar no diretório temas):

'; } if (isset($map) && $map != "") { $tema = ""; $map = str_replace("\\","/",$map); $map = basename($map); if (file_exists('temas/'.$map)) {$tema = 'temas/'.$map;} if (file_exists('temas/'.$map.'.map')) {$tema = 'temas/'.$map.".map";} if($tipo == "") echo "
Testando: $tema
";
	if ($tema != "")
	{
		if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
		{$mapa = ms_newMapObj("aplicmap/geral1windows.map");}
		else
		{$mapa = ms_newMapObj("aplicmap/geral1.map");}
		$nmapa = ms_newMapObj($tema);
		$temasn = $nmapa->getAllLayerNames();
		foreach ($temasn as $teman)
		{
			$layern = $nmapa->getLayerByName($teman);
			$layern->set("status",MS_DEFAULT);
			ms_newLayerObj($mapa, $layern);
		}
		if (isset($postgis_mapa))
		{
			if ($postgis_mapa != "")
			{
				$numlayers = $mapa->numlayers;
				for ($i=0;$i < $numlayers;$i++)
				{
					$layer = $mapa->getlayer($i);
					if ($layer->connectiontype == MS_POSTGIS)
					{
						if ($layer->connection == " ")
						{
							$layer->set("connection",$postgis_mapa);
						}
					}
				}
			}
		}
		if ($tipo == "mini")
		{
		 	 $mapa->setsize(50,50);
			 $sca = $mapa->scalebar;
			 $sca->set("status",MS_OFF);
		}
		if ($tipo == "grande")
		{
		 	 $mapa->setsize(300,300);
			 $sca = $mapa->scalebar;
			 $sca->set("status",MS_OFF);
		}

		$objImagem = $mapa->draw();
		$nomec = ($objImagem->imagepath).nomeRandomico()."teste.png";
		$objImagem->saveImage($nomec);
		$nomer = ($objImagem->imageurl).basename($nomec);
		if($tipo == "")
		{
			echo "";
			echo "
Erros:
"; $error = ms_GetErrorObj(); while($error && $error->code != MS_NOERR) { echo "
Error in %s: %s
", $error->routine, $error->message; $error = $error->next(); } } else { Header("Content-type: image/png"); ImagePng(ImageCreateFromPNG($nomec)); } } else {echo "
Arquivo não existe";} } ?>