path($this->photoJob->image_path); $photoprofile = Photoprofile::where('active', 1)->first(); $photocommands = []; foreach (explode(PHP_EOL, $photoprofile->commands) as $command) { if (count($photocommands) > 0) $photocommands[] = ' && gmic ' . escapeshellarg($absolutePath) . ' ' . $command . ' -o ' . escapeshellarg($absolutePath); else $photocommands[] = 'gmic ' . escapeshellarg($absolutePath) . ' ' . $command . ' -o ' . escapeshellarg($absolutePath); } $command = implode($photocommands); $result = Process::timeout(0)->run($command); $this->photoJob->update([ 'status' => $result->successful() ? 'done' : 'failed', ]); } }