/** * Reads a file content from the filesystem selected * * @param string file The filename (or path) * * @return mixed The content of the file */ public function read($file) { return $this->adapter->read($file); }
/** * Create a temporary file locally based on a file from an adapter. * A common case is image manipulation or video processing for example. It is * required to get the file first from the adapter and then write it to * a tmp file. Then manipulate it and upload the changed file. * The adapter might not be one that is using a local file system, so we first * get the file from the storage system, store it locally in a tmp file and * later load the new file that was generated based on the tmp file into the * storage adapter. This method here just generates the tmp file. * * @param Adapter $Storage Storage adapter * @param string $path Path / key of the storage adapter file * @param string $tmpFolder * @throws Exception * @return string */ protected function _tmpFile($Storage, $path, $tmpFolder = null) { try { $tmpFile = $this->createTmpFile($tmpFolder); file_put_contents($tmpFile, $Storage->read($path)); return $tmpFile; } catch (Exception $e) { $this->log($e->getMessage()); throw $e; } }