本文整理汇总了PHP中Aws\S3\S3Client::getPresignedUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP S3Client::getPresignedUrl方法的具体用法?PHP S3Client::getPresignedUrl怎么用?PHP S3Client::getPresignedUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\S3\S3Client
的用法示例。
在下文中一共展示了S3Client::getPresignedUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uri
/**
* 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: getS3Url
/**
* Creates url to S3 object
* @param string $filePath
* @param boolean $thumbnail
* @return mixed
*/
protected function getS3Url($filePath, $thumbnail = false)
{
$path = $thumbnail ? $this->get_thumbnail($filePath) : $filePath;
if ($this->config['s3']['presignUrl']) {
return $this->s3->getPresignedUrl($path, '+10 minutes');
} else {
// TODO: is non-presigned url might be created in place, without extra request ?
//sprintf('//%s/%s', $this->domain, $this->bucket.'/'.$path)
return $this->s3->getUrl($path);
}
}