1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-18 13:10:08 -07:00

Create dir if missing in StlRenderer

This commit is contained in:
David Hübner 2017-05-28 19:25:40 +02:00
parent 09c79c95b5
commit cf27da5521

View File

@ -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";