<HTML>

<BODY BGCOLOR="#CCCCCC">

<CENTER>

<H1>PHP/MapScript module test</H1>
<P>
 
<?php
//
// This example opens a regular MapServer .MAP file, renders the main
// Map image (with the default layers enabled), the legend and the 
// scale bar, and displays them in the HTML output.
//

//
// Load MapScript module.
//
if (PHP_OS == "WINNT" || PHP_OS == "WIN32")
{
  dl("php_mapscript.dll");
}
else
{
  dl("php_mapscript.so");
}

// 
// Load MapServer .map file
//
// You can download the MapServer demo data from http://mapserver.gis.umn.edu/
//
$map = ms_newMapObj("demo.map");

// print $map->numlayers;
// phpinfo();
 
//
// RENDER MAIN MAP
//
// Note: If you get errors with the saveWebImage() call below, then make sure
// that the directory specified by IMAGEPATH in the .MAP file exists and is
// writable by the httpd user.
//
$img = $map->draw();

$url = $img->saveWebImage();
printf("<IMG SRC=%s WIDTH=%d HEIGHT=%d>\n", $url, $map->width, $map->height);
 
//
// LEGEND
//
$img = $map->drawLegend();
$url = $img->saveWebImage();
printf("<P><IMG SRC=%s>\n", $url);
 
//
// SCALE BAR
//
$img = $map->drawScaleBar();
$url = $img->saveWebImage();
printf("<P><IMG SRC=%s>\n", $url);
 
?>
 
</BODY>
</HTML>

