closes #3 now able to load jpg as marker

merge-requests/1/head
Julien Veyssier 2016-12-06 14:31:46 +01:00
parent 7d3b29191f
commit 6c9251b8f3
3 changed files with 17 additions and 1 deletions

View File

@ -8,3 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added ### Added
- ability to load kml and csv (unicsv format) files - ability to load kml and csv (unicsv format) files
[#1](https://gitlab.com/eneiluj/gpxedit-oc/issues/1) @eneiluj [#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

View File

@ -203,6 +203,9 @@ class PageController extends Controller {
else if (endswith($file->getName(), '.csv') or endswith($file->getName(), '.CSV')){ else if (endswith($file->getName(), '.csv') or endswith($file->getName(), '.CSV')){
$fmt = 'unicsv'; $fmt = 'unicsv';
} }
else if (endswith($file->getName(), '.jpg') or endswith($file->getName(), '.JPG')){
$fmt = 'exif';
}
$args = Array('-i', $fmt, '-f', $file_clear_path, '-o', $args = Array('-i', $fmt, '-f', $file_clear_path, '-o',
'gpx', '-F', $gpx_target_clear_path); 'gpx', '-F', $gpx_target_clear_path);
$cmdparams = ''; $cmdparams = '';
@ -245,6 +248,7 @@ class PageController extends Controller {
} }
else if (getProgramPath('gpsbabel') !== null and else if (getProgramPath('gpsbabel') !== null and
(endswith($file->getName(), '.KML') or endswith($file->getName(), '.kml') or (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')) endswith($file->getName(), '.CSV') or endswith($file->getName(), '.csv'))
){ ){
$gpxContent = $this->toGpx($file); $gpxContent = $this->toGpx($file);
@ -359,6 +363,10 @@ class PageController extends Controller {
(endswith($elempath, '.kml') or endswith($elempath, '.KML'))){ (endswith($elempath, '.kml') or endswith($elempath, '.KML'))){
$responseTxt .= '<li class="kml ext_kml"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>'; $responseTxt .= '<li class="kml ext_kml"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
} }
else if ($gpsbabelpath !== null and
(endswith($elempath, '.jpg') or endswith($elempath, '.JPG'))){
$responseTxt .= '<li class="jpg ext_jpg"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
}
} }
} }
} }

View File

@ -582,7 +582,9 @@ $(document).ready(function(){
// set save name // set save name
var spl = file.split('/'); var spl = file.split('/');
var basename = spl[spl.length-1]; 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'); var savetreeurl = OC.generateUrl('/apps/gpxedit/getdircontentdir');