Example #1
0
 public function compute(JobInterface $job)
 {
     if (!$job instanceof ImageJob) {
         throw new RuntimeException('Image worker only process image job');
     }
     // throws a RuntimeException in case a parameter is missing
     $job->isOk(true);
     $parameters = $job->getParameters();
     $tmpFile = $this->filesystem->createEmptyFile(sys_get_temp_dir(), null, null, $parameters['format'], 50);
     $this->alchemyst->open($job->getSource())->turnInto($tmpFile, $this->specificationsFromJob($job))->close();
     return new Result(Result::TYPE_PATHFILE, $tmpFile);
 }