Example #1
0
 public function getPathToFile(FileInterface $file)
 {
     //-------------------------------------------------------------
     // Get session or create a new one for the signed url
     // The signed url will stay in session until it expire.
     // Afterwards a new request is sent to aws and it's cached again.
     $key = $file->getPath();
     $pathToFile = $this->cache->storeAndGet($key, function () use($key) {
         $signedPath = $this->s3->getObjectUrl($this->bucket, $this->directory . $key, time() + $this->signingExpire);
         return $signedPath;
     });
     return $pathToFile;
 }
Example #2
0
 public function getPathToFile(FileInterface $file)
 {
     return $this->url . $file->getPath();
 }