if ($entry['nateastings']) {
     if ($entry['natgrlen'] == 6) {
         $entry['nateastings'] += 50;
         $entry['natnorthings'] += 50;
     }
     list($wgs84_lat, $wgs84_long) = $conv->national_to_wgs84($entry['nateastings'], $entry['natnorthings'], $square->reference_index);
 } else {
     list($wgs84_lat, $wgs84_long) = $conv->internal_to_wgs84($square->x, $square->y, $square->reference_index);
 }
 $point = new kmlPoint($wgs84_lat, $wgs84_long);
 $placemark = new kmlPlacemark_Photo($entry['gridimage_id'], $square->grid_reference . ' :: ' . $title, $point);
 $placemark->useHoverStyle();
 $image = new GridImage();
 $image->fastInit($entry);
 $placemark->useCredit($image->realname, "http://{$_SERVER['HTTP_HOST']}/photo/" . $image->gridimage_id);
 $html .= getHtmlLinkP($placemark->link, $square->grid_reference . ' :: ' . $title . ' by ' . $image->realname);
 $linkTag = "<a href=\"" . $placemark->link . "\">";
 $details = $image->getThumbnail(120, 120, 2);
 $thumb = $details['server'] . $details['url'];
 $thumbTag = $details['html'];
 $description = $linkTag . $thumbTag . "</a><br/>" . GeographLinks($image->comment) . " (" . $linkTag . "view full size</a>)" . "<br/><br/> &copy; Copyright <a title=\"view user profile\" href=\"http://" . $_SERVER['HTTP_HOST'] . $image->profile_link . "\">" . $image->realname . "</a> and licensed for reuse under this <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">Creative Commons Licence</a><br/><br/>";
 $placemark->setItemCDATA('description', $description);
 //yes that is uppercase S!
 $placemark->setItemCDATA('Snippet', strip_tags($description));
 $placemark->useImageAsIcon($thumb);
 if (strlen($entry['view_direction']) && $entry['view_direction'] != -1) {
     $placemark->addViewDirection($entry['view_direction']);
 }
 $Region = $placemark->addChild('Region');
 $Region->setPoint($point, 0.01);
 $delta = $entry['gridimage_id'] % 30;
Esempio n. 2
0
$links->setItem('name', 'Next Level...');
$prefix = $db->GetRow('select * from gridprefix where prefix=' . $db->Quote($square->gridsquare) . ' limit 1');
$left = $prefix['origin_x'] + intval($square->eastings / 20) * 20;
$right = $left + 20 - 1;
$bottom = $prefix['origin_y'] + intval($square->northings / 20) * 20;
$top = $bottom + 20 - 1;
$rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
$sql_where = "CONTAINS(GeomFromText({$rectangle}),point_xy)";
$photos = $db->GetAll("select \r\ngridimage_id,grid_reference,title,title2,imagecount,view_direction,natgrlen,realname,\r\nwgs84_lat,wgs84_long\r\nfrom gridimage_kml \r\nwhere {$sql_where} and tile = 1\r\norder by null");
foreach ($photos as $id => $entry) {
    $point = new kmlPoint($entry['wgs84_lat'], $entry['wgs84_long']);
    $title = combineTexts($entry['title'], $entry['title2']);
    if ($entry['imagecount'] == 1) {
        $placemark = new kmlPlacemark($entry['gridimage_id'], $entry['grid_reference'] . ' :: ' . $title, $point);
        $placemark->useCredit($entry['realname'], "http://{$_SERVER['HTTP_HOST']}/photo/{$entry['gridimage_id']}");
        $html .= getHtmlLinkP($placemark->link, $entry['grid_reference'] . ' :: ' . $entry['title'] . ' by ' . $entry['realname']);
        $placemark->setItem('description', $placemark->link);
        $r = $entry['natgrlen'] > 4 ? '' : 'r';
        if ($entry['view_direction'] != -1) {
            $placemark->useHoverStyle('p1d' . $r);
            $Style = $placemark->addChild('Style');
            $IconStyle = $Style->addChild('IconStyle');
            $IconStyle->setItem('heading', $entry['view_direction']);
        } else {
            $placemark->useHoverStyle('p1' . $r);
        }
    } else {
        $placemark = new kmlPlacemark($entry['grid_reference'], $entry['grid_reference'] . ' :: ' . $entry['imagecount'] . ' images e.g. ' . $title, $point);
        $placemark->setItem('description', "http://{$_SERVER['HTTP_HOST']}/gridref/{$entry['grid_reference']}");
        $c = $entry['imagecount'] > 20 ? 20 : ($entry['imagecount'] > 4 ? 10 : $entry['imagecount']);
        $placemark->useHoverStyle('p' . $c);
Esempio n. 3
0
$right = $left + 5 - 1;
$bottom = $prefix['origin_y'] + intval($square->northings / 5) * 5;
$top = $bottom + 5 - 1;
$rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
$sql_where = "CONTAINS(GeomFromText({$rectangle}),point_xy)";
$photos = $db->GetAll("select \r\ngridimage_id,grid_reference,title,title2,imagecount,user_id,realname,x,y,view_direction,credit_realname,realname,\r\nwgs84_lat,wgs84_long\r\nfrom gridimage_kml \r\nwhere {$sql_where}\r\norder by null");
foreach ($photos as $id => $entry) {
    if ($entry['imagecount'] == 1) {
        $point = new kmlPoint($entry['wgs84_lat'], $entry['wgs84_long']);
        $title = combineTexts($entry['title'], $entry['title2']);
        $placemark = new kmlPlacemark_Photo($entry['gridimage_id'], $entry['grid_reference'] . ' :: ' . $title, $point);
        $placemark->useHoverStyle();
        $image = new GridImage();
        $image->fastInit($entry);
        $placemark->useCredit($image->realname, "http://{$_SERVER['HTTP_HOST']}/photo/" . $image->gridimage_id);
        $html .= getHtmlLinkP($placemark->link, $entry['grid_reference'] . ' :: ' . $title . ' by ' . $image->realname);
        $linkTag = "<a href=\"" . $placemark->link . "\">";
        $details = $image->getThumbnail(120, 120, 2);
        $thumb = $details['server'] . $details['url'];
        $thumbTag = $details['html'];
        $description = $linkTag . $thumbTag . "</a><br/>" . GeographLinks($image->comment) . " (" . $linkTag . "view full size</a>)" . "<br/><br/> &copy; Copyright <a title=\"view user profile\" href=\"http://" . $_SERVER['HTTP_HOST'] . $image->profile_link . "\">" . $image->realname . "</a> and licensed for reuse under this <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">Creative Commons Licence</a><br/><br/>";
        $placemark->setItemCDATA('description', $description);
        //yes that is uppercase S!
        $placemark->setItemCDATA('Snippet', strip_tags($description));
        $placemark->useImageAsIcon($thumb);
        if (strlen($entry['view_direction']) && $entry['view_direction'] != -1) {
            $placemark->addViewDirection($entry['view_direction']);
        }
        $Region = $placemark->addChild('Region');
        $Region->setPoint($point, 0.01);
        $delta = $entry['gridimage_id'] % 30;