NextGen Gallery's Attachment support. Thanks to Stephan Klein (https://klein-gedruckt.de/2015/03/wordpress-plugin-wp-gpx-maps/)
This commit is contained in:
parent
9f63c289c9
commit
d00e3816d5
12
readme.txt
12
readme.txt
|
@ -1,11 +1,11 @@
|
|||
=== WP GPX Maps ===
|
||||
|
||||
Contributors: bastianonm
|
||||
Contributors: bastianonm, Stephan Klein
|
||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML
|
||||
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
|
||||
Requires at least: 2.0.0
|
||||
Tested up to: 4.0
|
||||
Stable tag: 1.3.6
|
||||
Tested up to: 4.1.1
|
||||
Stable tag: 1.3.7
|
||||
|
||||
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
|
||||
|
||||
|
@ -33,6 +33,10 @@ Even if you don't have a gps camera, this plugin can retrive the image position
|
|||
|
||||
Old NGGallery Images (without gps data) and gpx: <a href="http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/">http://www.pedemontanadelgrappa.it/mappe/itinerario-3-alta-via-degli-eroi/</a>
|
||||
|
||||
Post Attachments Integration:
|
||||
|
||||
This version is extended by Stephan Klein (https://klein-gedruckt.de/2015/03/wordpress-plugin-wp-gpx-maps/) and supports displaying all images attached to a post without using NGG.
|
||||
|
||||
Translated into 14 languages:
|
||||
|
||||
- Catalan ca
|
||||
|
@ -187,6 +191,8 @@ Yes!
|
|||
1. Altitude & Speed & Hearth rate
|
||||
|
||||
== Changelog ==
|
||||
= 1.3.7 =
|
||||
* NextGen Gallery's Attachment support. Thanks to Stephan Klein (https://klein-gedruckt.de/2015/03/wordpress-plugin-wp-gpx-maps/)
|
||||
= 1.3.6 =
|
||||
* Fix: remote file download issue
|
||||
* Fix: download file link with WPML
|
||||
|
|
|
@ -226,6 +226,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$waypointIcon = findValue($attr, "waypointicon", "wpgpxmaps_map_waypoint_icon", "");
|
||||
$ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
|
||||
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
|
||||
// folgende Zeile hinzugefügt:
|
||||
$attachments = findValue($attr, "attachments", "wpgpxmaps_map_attachments", false);
|
||||
$download = findValue($attr, "download", "wpgpxmaps_download", "");
|
||||
$dtoffset = findValue($attr, "dtoffset", "wpgpxmaps_dtoffset", 0);
|
||||
$distanceType = findValue($attr, "distanceType", "wpgpxmaps_distance_type", 0);
|
||||
|
@ -564,6 +566,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
|
|||
$ngimgs_data .= '<span lat="'.$img['lat'].'" lon="'.$img['lon'].'">'.$data.'</span>';
|
||||
}
|
||||
}
|
||||
// Folgende Zeilen hinzugefügt
|
||||
if ($attachments == true) {
|
||||
$attimgs = getAttachedImages($points_x_time, $points_x_lat, $points_x_lon, $dtoffset, $error);
|
||||
foreach ($attimgs as $img) {
|
||||
$data = $img['data'];
|
||||
$data = str_replace("\n","",$data);
|
||||
$ngimgs_data .= '<span lat="'.$img['lat'].'" lon="'.$img['lon'].'">'.$data.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!($skipcache == true)) {
|
||||
|
||||
|
|
|
@ -130,6 +130,8 @@ function WP_GPX_Maps_html_page() {
|
|||
<li><b>currentIcon</b>: Current position icon (when mouse hover)</li>
|
||||
<li><b>nggalleries</b>: NextGen Gallery id or a list of Galleries id separated by a comma</li>
|
||||
<li><b>ngimages</b>: NextGen Image id or a list of Images id separated by a comma</li>
|
||||
<!-- Zeile Hinzugefügt: -->
|
||||
<li><b>attachments</b>: show all images that are attached to post (default is false)</li>
|
||||
<li><b>dtoffset</b>: the difference (in seconds) between your gpx tool date and your camera date</li>
|
||||
<li><b>zoomonscrollwheel</b>: zoom on map when mouse scroll wheel (default is FALSE)</li>
|
||||
<li><b>download</b>: Allow users to download your GPX file (default is FALSE)</li>
|
||||
|
|
|
@ -2,6 +2,66 @@
|
|||
|
||||
require_once("wp-gpx-maps_utils_nggallery.php");
|
||||
|
||||
function getAttachedImages($dt, $lat, $lon, $dtoffset, &$error)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
try {
|
||||
$attachments = get_children( array(
|
||||
'post_parent' => get_the_ID(),
|
||||
'post_type' => 'attachment',
|
||||
'numberposts' => -1, // show all -1
|
||||
'post_status' => 'inherit',
|
||||
'post_mime_type' => 'image',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order ASC')
|
||||
);
|
||||
|
||||
foreach ($attachments as $attachment_id => $attachment) {
|
||||
|
||||
$img_src = wp_get_attachment_image_src($attachment_id,'full');
|
||||
$img_thmb = wp_get_attachment_image_src($attachment_id,'thumbnail');
|
||||
$img_metadata = wp_get_attachment_metadata( $attachment_id);
|
||||
|
||||
$item = array();
|
||||
$item["data"] = wp_get_attachment_link( $attachment_id, array(105,105) );
|
||||
|
||||
if (is_callable('exif_read_data')) {
|
||||
$exif = @exif_read_data($img_src[0]);
|
||||
if ($exif !== false)
|
||||
{
|
||||
$item["lon"] = getExifGps($exif["GPSLongitude"], $exif['GPSLongitudeRef']);
|
||||
$item["lat"] = getExifGps($exif["GPSLatitude"], $exif['GPSLatitudeRef']);
|
||||
if (($item["lat"] != 0) || ($item["lon"] != 0))
|
||||
{
|
||||
$result[] = $item;
|
||||
}
|
||||
else if (isset($p->imagedate))
|
||||
{
|
||||
$_dt = strtotime($p->imagedate) + $dtoffset;
|
||||
$_item = findItemCoordinate($_dt, $dt, $lat, $lon);
|
||||
if ($_item != null)
|
||||
{
|
||||
$item["lat"] = $_item["lat"];
|
||||
$item["lon"] = $_item["lon"];
|
||||
$result[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$error .= 'Error When Retrieving attached images: $e <br />';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function sitePath()
|
||||
{
|
||||
return substr(substr(__FILE__, 0, strrpos(__FILE__,'wp-content')), 0, -1);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
return is_plugin_active("nextgen-gallery-pro/nggallery-pro.php");
|
||||
}
|
||||
|
||||
|
||||
function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error)
|
||||
{
|
||||
|
||||
|
@ -95,7 +96,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* END FIX NEXT GEN GALLERY PRO */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue