Hi,
when i upload a file i want to execute some shell commands to work with this file.
in my case, when i upload a GPX file, there should be called a command-line i made (several commands piped one after each other) to generate some special files i want to use later.
for example:
gpsbabel -i gpx -f input.gpx -x simplify,crosstrack,error=0.002k -o gpx -F - | python gpx2svg | svgo -i - -o - | gzip -f > output.svgz
i made a hook for upload in config.php to test. this one works:
kirby()->hook('panel.file.upload', 'gpxExtract');
kirby()->hook('panel.file.replace', 'gpxExtract');
function gpxExtract($file) {
try {
// check file type
if ($file->extension() == 'gpx') {
f::write(kirby()->roots()->index() .'/log.txt', $file->filename());
}
} catch (Exception $e) {
return response::error($e->getMessage());
}
}
then i tried to exec or shell_exec my commandline (instead of the log-write commandline). but i can’t get it to work.
maybe it’s a syntax-problem. (i tried several things, without success)
thx in advance