From 6c9251b8f3f6ccaef5de1a61be906dd73f9a226c Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 6 Dec 2016 14:31:46 +0100 Subject: [PATCH] closes #3 now able to load jpg as marker --- CHANGELOG.md | 6 ++++++ controller/pagecontroller.php | 8 ++++++++ js/gpxedit.js | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a12484..4ad43b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,3 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - ability to load kml and csv (unicsv format) files [#1](https://gitlab.com/eneiluj/gpxedit-oc/issues/1) @eneiluj +- ability to load jpg files as markers, conversion with gpsbabel like kml and csv + [#3](https://gitlab.com/eneiluj/gpxedit-oc/issues/3) @eneiluj + +### Fixed +- remove $.parseXML, apparently useless and producing errors + [#5](https://gitlab.com/eneiluj/gpxedit-oc/issues/5) @eneiluj diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index c0248a0..d8e8515 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -203,6 +203,9 @@ class PageController extends Controller { else if (endswith($file->getName(), '.csv') or endswith($file->getName(), '.CSV')){ $fmt = 'unicsv'; } + else if (endswith($file->getName(), '.jpg') or endswith($file->getName(), '.JPG')){ + $fmt = 'exif'; + } $args = Array('-i', $fmt, '-f', $file_clear_path, '-o', 'gpx', '-F', $gpx_target_clear_path); $cmdparams = ''; @@ -245,6 +248,7 @@ class PageController extends Controller { } else if (getProgramPath('gpsbabel') !== null and (endswith($file->getName(), '.KML') or endswith($file->getName(), '.kml') or + endswith($file->getName(), '.JPG') or endswith($file->getName(), '.jpg') or endswith($file->getName(), '.CSV') or endswith($file->getName(), '.csv')) ){ $gpxContent = $this->toGpx($file); @@ -359,6 +363,10 @@ class PageController extends Controller { (endswith($elempath, '.kml') or endswith($elempath, '.KML'))){ $responseTxt .= '
  • '.$elem->getName().'
  • '; } + else if ($gpsbabelpath !== null and + (endswith($elempath, '.jpg') or endswith($elempath, '.JPG'))){ + $responseTxt .= '
  • '.$elem->getName().'
  • '; + } } } } diff --git a/js/gpxedit.js b/js/gpxedit.js index afe3476..d0fbf6b 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -582,7 +582,9 @@ $(document).ready(function(){ // set save name var spl = file.split('/'); var basename = spl[spl.length-1]; - $('input#saveName').val(basename); + $('input#saveName').val( + basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx') + ); }); var savetreeurl = OC.generateUrl('/apps/gpxedit/getdircontentdir');