| @@ 76-78 (lines=3) @@ | ||
| 73 | private function generateImage(MediaInterface $media, array $parameters, $filename) |
|
| 74 | { |
|
| 75 | $tmp = $this->getTemporaryFile(); |
|
| 76 | if (@file_put_contents($tmp, $this->server->getSource()->read($media->getImage())) === false) { |
|
| 77 | throw new FilesystemException('Unable to write temporary file'); |
|
| 78 | } |
|
| 79 | try { |
|
| 80 | $this->server->getCache()->write($filename, $this->server->getApi()->run($tmp, $parameters)); |
|
| 81 | } catch (\Exception $e) { |
|
| @@ 34-36 (lines=3) @@ | ||
| 31 | { |
|
| 32 | if (!$this->server->getSource()->has($destination)) { |
|
| 33 | $tmp = tempnam(sys_get_temp_dir(), 'media'); |
|
| 34 | if (@file_put_contents($tmp, $this->server->getSource()->read($source)) === false) { |
|
| 35 | throw new FilesystemException('unable_to_write_temporary_media_file'); |
|
| 36 | } |
|
| 37 | $this->server->getCache()->write($destination, $this->server->getApi()->run($tmp, $parameters)); |
|
| 38 | @unlink($tmp); |
|
| 39 | } |
|