From cf27da55219706c9b2ca21339db9ab354315ef3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCbner?= Date: Sun, 28 May 2017 19:25:40 +0200 Subject: [PATCH] Create dir if missing in StlRenderer --- src/AppBundle/Service/Stl/StlRendererService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AppBundle/Service/Stl/StlRendererService.php b/src/AppBundle/Service/Stl/StlRendererService.php index 818c856..fcf0b6d 100644 --- a/src/AppBundle/Service/Stl/StlRendererService.php +++ b/src/AppBundle/Service/Stl/StlRendererService.php @@ -8,7 +8,6 @@ use AppBundle\Exception\RenderFailedException; use Symfony\Component\Process\Process; use Symfony\Component\Process\ProcessBuilder; -// TODO create images/{color} directory class StlRendererService { /** @@ -161,7 +160,7 @@ class StlRendererService * http://www.povray.org/ * * @param string $file The full path to .pov file to be rendered - * @param $to + * @param string $to Destination directory path * * @throws RenderFailedException throws exception if there are problems rendering image * @throws FileNotFoundException throws exception if source file not found @@ -174,6 +173,10 @@ class StlRendererService throw new FileNotFoundException($file); } + if(!file_exists($to)) { + mkdir($to); + } + $filename = pathinfo($file)['filename']; $outputFile = "{$to}{$filename}.png";