/**
  * @test
  */
 public function cleansUp()
 {
     $manatee = __DIR__ . '/../../../self-lussing-manatee.jpg';
     $fm = new TemporaryFileManager($this->root . '/tussi', 0700);
     $ret = $fm->addFile($manatee);
     $ret2 = $fm->addFile($manatee);
     $this->assertNotEquals($ret, $ret2);
     $this->assertCount(2, glob($this->root . '/tussi/*'));
     unset($fm);
     $this->assertCount(0, glob($this->root . '/tussi/*'));
 }
Example #2
0
 /**
  * Fetch a single output version using Zencoder Job details
  *
  * @param  Job    $job     Zencoder Job
  * @param  string $version Version identifier
  * @return array Temporary filenames for video and its thumb
  */
 protected function fetchOutput(Job $job, $version)
 {
     $output = $job->outputs[$version];
     $details = $this->getService()->outputs->details($output->id);
     $tempnam = $this->tempFiles->add(file_get_contents($details->url));
     $thumb = array_shift($details->thumbnails[0]->images);
     $thumbnam = $this->tempFiles->add(file_get_contents($thumb->url));
     return array($tempnam, $thumbnam);
 }
Example #3
0
 /**
  * @return string
  * @throws RuntimeException
  */
 public function execute()
 {
     if ($this->isExecuted()) {
         throw new RuntimeException('Helper already executed');
     }
     $img = $this->createImagick();
     foreach ($this->getCommands() as $command) {
         $command->execute($img);
     }
     $this->isExecuted = true;
     return $this->tempFiles->add($img->getImageBlob());
 }
 protected function doCreateAllTemporaryVersions(File $file)
 {
     return array($this->identifier => $this->tempFiles->addFile($this->storage->retrieve($file->getResource())));
 }