//version: 1195772503
$db['hostname'] = 'localhost';
$db['username'] = 'root';
$db['password'] = '';
$db['database'] = 'opensim';
mysql_connect($db['hostname'],$db['username'],$db['password']);
@mysql_select_db($db['database']) or die( "Unable to select database");
$query = "SELECT regionName, locX, locY FROM regions ORDER BY locX ASC, locY ASC, regionName DESC;";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$regions[$row['regionName']] = array('locX' => $row['locX'], 'locY' => $row['locY']);
}
mysql_free_result($result);
mysql_close();
print_r($regions);
foreach($regions as $regionName => $coords)
{
print_r($regionName);
print_r($coords);
}
//Width and height of each region
$regionSize = 50;
//Center on a coordinate
$centerX = 1000;
$centerY = 1000;
//set X, Y upper bounds
$maxX = 1005;
$maxY = 1005;
//set X, Y lower bounds
$minX = 995;
$minY = 995;
//Create an image, properly sized
$imageWidth = (($maxX-$minX)*$regionSize);
$imageHeight = (($maxY-$minY)*$regionSize);
echo $imageWidth;
echo $imageHeight;
$heading = ' ';
$stringData = $heading.$rectangles.$text.$ending;
$fh = fopen('map.svg', 'w');
fwrite($fh, $stringData);
fclose($fh);
echo '