/** * @test */ public function adds() { $manatee = __DIR__ . '/../../../self-lussing-manatee.jpg'; $fm = new TemporaryFileManager($this->root . '/tussi', 0700); $ret = $fm->add(file_get_contents($manatee)); $this->assertStringStartsWith($this->root, $ret); $this->assertFileEquals($manatee, $ret); }
/** * 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); }
/** * @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()); }