getObjectUrl() public method

Returns the URL to an object identified by its bucket and key. If an expiration time is provided, the URL will be signed and set to expire at the provided time.
public getObjectUrl ( string $bucket, string $key, mixed $expires = null, array $args = [] ) : string
$bucket string The name of the bucket where the object is located
$key string The key of the object
$expires mixed The time at which the URL should expire
$args array Arguments to the GetObject command. Additionally you can specify a "Scheme" if you would like the URL to use a different scheme than what the client is configured to use
return string The URL to the object
Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function getURL($key)
 {
     if ($this->cdnDomain) {
         return $this->cdnDomain . '/' . $key;
     }
     if (!$this->arr($this->recentFiles)->keyExists($key)) {
         $this->recentFiles[$key]['ObjectURL'] = $this->s3Client->getObjectUrl($this->bucket, $key);
     }
     return $this->recentFiles[$key]['ObjectURL'];
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function getURL($key)
 {
     if (!$this->arr($this->recentFiles)->keyExists($key)) {
         $this->recentFiles[$key]['ObjectURL'] = $this->s3Client->getObjectUrl($this->bucket, $key);
     }
     if ($this->cdnDomain) {
         $objectUrl = $this->url($this->recentFiles[$key]['ObjectURL']);
         $cdnDomain = $this->url($this->cdnDomain);
         $objectUrl->setHost($cdnDomain->getHost())->setScheme($cdnDomain->getScheme());
         return $objectUrl->val();
     }
     return $this->recentFiles[$key]['ObjectURL'];
 }