hi again folks
I have a successful post code distance calculator working, and have found the script on this site
link : http://www.phpbuilder.com/snippet/detail.php?type=snippet&id=1104
code
<?php
include 'config.php';
$link= mysql_connect($db_host,$db_user,$db_pass) or die (mysql_error());
mysql_select_db ($db_name) or die (mysql_error());
function getpost($postcode)
{
$char = 1;
do {
$part = substr($postcode, 0, $char);
$result = mysql_query("SELECT * FROM postcodes WHERE Pcode LIKE '$postcode'");
$rows = mysql_num_rows($result);
++$char;
}
while ($rows > 1);
$results = mysql_fetch_array($result);
return $results['post'];
}
$post = getpost($_GET['postcode']);
$postcode = $post;
$sql = "SELECT * FROM postcodes WHERE Pcode='$postcode'";
$results = mysql_query($sql);
$row = mysql_fetch_array($results);
$latitude = $r['Latitude'];
$longitude = $r['Longitude'];
settype($latitude, "float");
settype($longitude, "float");
$longwidth = (10.40480+1.76791); // 12.17271
$latheight = (58.67925-49.97763);//8.70162
$canvaswidth = 381;
$canvasheight = 440;
$amountleft = (((10.40480+$longitude)/$longwidth)*$canvaswidth);
$amountdown = ($canvasheight-(((($latitude-49.97763)/$latheight))*$canvasheight));
$amountleft = round($amountleft);
$amountdown = round($amountdown);
$image = imagecreatefrompng("croppedmap.png");
$red = imagecolorallocate($image, 255,0,0);
imagefilledrectangle($image,$amountleft-2,$amountdown-2,$amountleft+2,$amountdown+2,$red);
header ("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
so call me silly or stupid, but does one not need the map pictures to use for this?
If so anyone know where they are?