diff --git a/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php b/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php index a5190900a..a5d251224 100644 --- a/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php +++ b/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php @@ -15,7 +15,7 @@ use Liip\ImagineBundle\Binary\FileBinaryInterface; use Liip\ImagineBundle\Model\Binary; use Symfony\Component\Process\Exception\ProcessFailedException; -use Symfony\Component\Process\ProcessBuilder; +use Symfony\Component\Process\Process; class JpegOptimPostProcessor implements PostProcessorInterface, ConfigurablePostProcessorInterface { @@ -141,33 +141,32 @@ public function processWithConfiguration(BinaryInterface $binary, array $options throw new \RuntimeException(sprintf('Temp file can not be created in "%s".', $tempDir)); } - $pb = new ProcessBuilder([$this->jpegoptimBin]); - + $commandline = $this->jpegoptimBin; $stripAll = array_key_exists('strip_all', $options) ? $options['strip_all'] : $this->stripAll; if ($stripAll) { - $pb->add('--strip-all'); + $commandline .= ' --strip-all'; } $max = array_key_exists('max', $options) ? $options['max'] : $this->max; if ($max) { - $pb->add('--max='.$max); + $commandline .= ' --max='.$max; } $progressive = array_key_exists('progressive', $options) ? $options['progressive'] : $this->progressive; if ($progressive) { - $pb->add('--all-progressive'); + $commandline .= ' --all-progressive'; } else { - $pb->add('--all-normal'); + $commandline .= ' --all-normal'; } - $pb->add($input); + $commandline .= ' '.$input; if ($binary instanceof FileBinaryInterface) { copy($binary->getPath(), $input); } else { file_put_contents($input, $binary->getContent()); } - $proc = $pb->getProcess(); + $proc = new Process($commandline); $proc->run(); if (false !== strpos($proc->getOutput(), 'ERROR') || 0 !== $proc->getExitCode()) {