Show OSM iframe if image is geotagged

If the spatialhelper and the geophp plugins are available, then show a
iframe from open street map with the location of the photo.

SPR-814
This commit is contained in:
Michael Große 2017-03-31 13:32:20 +02:00
commit f2a0ea7b7d
No known key found for this signature in database
GPG key ID: 7E31028FBFEACC79

View file

@ -169,7 +169,30 @@ header('X-UA-Compatible: IE=edge,chrome=1');
<h2><?php print nl2br(hsc(tpl_img_getTag('simple.title'))); ?></h2>
<?php if(function_exists('tpl_img_meta')): ?>
<?php tpl_img_meta(); ?>
<?php
tpl_img_meta();
/** @var helper_plugin_spatialhelper_index $spatial */
$spatial = plugin_load('helper', 'spatialhelper_index');
if ($spatial && plugin_load('helper', 'geophp')) {
global $IMG;
$point = $spatial->getCoordsFromExif($IMG);
if ($point) {
$long = $point->getX();
$lat = $point->getY();
$latShort = round($lat,3);
$longShort = round($long,3);
$hrefOSM = "https://www.openstreetmap.org/?mlat=$lat&mlon=$long#map=18/$lat/$long";
$srcOSM = 'https://www.openstreetmap.org/export/embed.html?bbox='.($long-0.004).','.($lat-0.002).','.($long+0.004).','.($lat+0.002).'&layer=mapnik&marker='.$lat.','.$long;
echo '<dl>';
echo '<dt title="Open Street Maps">OSM:</dt><dd>';
echo '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$srcOSM.'" style="border: 1px solid black"></iframe><br/><small><a href="'.$hrefOSM.'">View Larger Map</a></small>';
echo '</dd>';
echo '</dl>';
}
}
?>
<?php else: /* deprecated since Release 2014-05-05 */ ?>
<dl>
<?php