Пример #1
1
 /**
  * Return the web-accessible uri for the given file.
  *
  * @param  string            $file
  * @return string            The file uri
  * @throws \RuntimeException
  */
 public function uri($file)
 {
     if (null !== $this->filenameFilter) {
         $file = $this->filenameFilter->filter($file);
     }
     try {
         $request = $this->s3Client->get($this->getBucket() . '/' . $file);
         return $this->s3Client->getPresignedUrl($request, $this->getUriExpirationTime());
     } catch (S3Exception $e) {
         if (!$this->getThrowExceptions()) {
             return null;
         }
         throw new \RuntimeException('Exception thrown by Aws\\S3\\S3Client: ' . $e->getMessage(), null, $e);
     }
 }
Пример #2
0
 /**
  * Return the path for the given file.
  *
  * @param  string $file
  * @return string The file path
  */
 public function path($file)
 {
     $sep = DIRECTORY_SEPARATOR;
     $path = $this->getBasePath();
     if (null !== $path) {
         if (strpos($path, '://') !== false) {
             $sep = '/';
         }
         $path .= $sep;
     }
     if (null !== $this->filenameFilter) {
         $file = $this->filenameFilter->filter($file);
     }
     return $path . str_replace(array('\\', '/'), $sep, $file);
 }