当前位置: 首页>>代码示例>>PHP>>正文


PHP S3Client::getObjectUrl方法代码示例

本文整理汇总了PHP中Aws\S3\S3Client::getObjectUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP S3Client::getObjectUrl方法的具体用法?PHP S3Client::getObjectUrl怎么用?PHP S3Client::getObjectUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aws\S3\S3Client的用法示例。


在下文中一共展示了S3Client::getObjectUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resolveUrlFor

 /**
  * @param $path
  * @return string
  */
 public function resolveUrlFor($path)
 {
     $path = trim($this->prefix, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR);
     return $this->client->getObjectUrl($this->bucket, $path);
 }
开发者ID:karion,项目名称:mydrinks,代码行数:9,代码来源:S3UrlResolver.php

示例2: getObjectUrl

 /**
  * getObjectUrl
  *
  * @param string $key
  * @param mixed  $expires
  * @param array  $params
  *
  * @return string
  */
 public function getObjectUrl($key, $expires = null, array $params = array())
 {
     return $this->client->getObjectUrl($this->name, $key, $expires, $params);
 }
开发者ID:m6web,项目名称:aws-bundle,代码行数:13,代码来源:Bucket.php

示例3: getObjectUrl

 /**
  * Returns the URL to an object identified by its bucket and key.
  *
  * The URL returned by this method is not signed nor does it ensure the the
  * bucket and key given to the method exist. If you need a signed URL, then
  * use the {@see \Aws\S3\S3Client::createPresignedRequest} method and get
  * the URI of the signed request.
  *
  * @param string $bucket  The name of the bucket where the object is located
  * @param string $key     The key of the object
  *
  * @return string The URL to the object
  */
 public function getObjectUrl($site, $key)
 {
     $config = $this->_config;
     $bucket = $config['bucket'];
     $builtBucket = strlen($bucket) > 0 ? $site . '.' . $bucket : $site;
     return $this->_s3Client->getObjectUrl($builtBucket, $key);
 }
开发者ID:EnterpriseConsultingDeveloper,项目名称:WhiteRabbitsComponents,代码行数:20,代码来源:WRS3Client.php

示例4: getUrl

 /**
  * {@inheritdoc}
  */
 public function getUrl($filename)
 {
     $path = $filename;
     if ($this->directory) {
         $path = sprintf('%s/%s', $this->directory, $path);
     }
     return $this->client->getObjectUrl($this->bucket, $path);
 }
开发者ID:harpcio,项目名称:FileUploaderBundle,代码行数:11,代码来源:Aws3Resolver.php

示例5: uploadHtml

 /**
  * @param string $html the content to be uploaded.
  * @return string the URL of the uploaded content.
  */
 public function uploadHtml($headers, $html)
 {
     $file = date('YmdHis-') . uniqid("", true);
     $key = (!empty($this->directoryPath) ? $this->directoryPath . '/' : '') . $file . '.html';
     $url = $this->_client->getObjectUrl($this->bucket, $key);
     $result = $this->_client->putObject(array_merge(['ACL' => 'public-read', 'Bucket' => $this->bucket, 'Body' => str_replace($this->archiveUrlTag, $url, $html), 'CacheControl' => 'max-age=31536000, public', 'ContentType' => 'text/html', 'Key' => $key, 'Metadata' => ['X-UID-MailHeader' => \yii\helpers\Json::encode($headers)], 'Expires' => gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime('+5 year'))], $this->uploadOptions));
     if ($result) {
         return $url;
     } else {
         return false;
     }
 }
开发者ID:petrabarus,项目名称:yii2-archivable-mailer,代码行数:16,代码来源:S3Provider.php

示例6: find

 /**
  * {@inheritDoc}
  */
 public function find($path)
 {
     $s3Url = $this->client->getObjectUrl($this->bucket, trim($this->prefix, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR));
     if (false == @getimagesize($s3Url)) {
         return $this->fallbackLoader->find($path);
     }
     $tmpFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . basename($s3Url);
     file_put_contents($tmpFilePath, file_get_contents($s3Url));
     $mimeType = $this->mimeTypeGuesser->guess($tmpFilePath);
     unlink($tmpFilePath);
     return new Binary(file_get_contents($s3Url), $mimeType, $this->extensionGuesser->guess($mimeType));
 }
开发者ID:karion,项目名称:mydrinks,代码行数:15,代码来源:S3Loader.php

示例7: getTokenUrl

 /**
  * @param $file_contenthash
  * @param $file_statusamazon
  * @return string
  */
 public function getTokenUrl($file_contenthash, $file_statusamazon)
 {
     $fileRelativeLocation = substr($this->path_from_hash($file_contenthash), 1);
     if (!class_exists('S3Util')) {
         require_once __DIR__ . '/S3Util.php';
     }
     $file = S3Util::getPrefix() . $fileRelativeLocation;
     if ($file_statusamazon == 'public') {
         return S3Util::getS3Url() . $fileRelativeLocation;
     }
     return $this->client->getObjectUrl($this->bucket_name, $file, '+5 minutes');
 }
开发者ID:EduardoKrausME,项目名称:moodledata-to-AWS,代码行数:17,代码来源:SendS3.php

示例8: __invoke

 /**
  * Create a link to a S3 object from a bucket. If expiration is not empty, then it is used to create
  * a signed URL
  *
  * @param  string     $object The object name (full path)
  * @param  string     $bucket The bucket name
  * @param  string|int $expiration The Unix timestamp to expire at or a string that can be evaluated by strtotime
  * @throws InvalidDomainNameException
  * @return string
  */
 public function __invoke($object, $bucket = '', $expiration = '')
 {
     $bucket = trim($bucket ?: $this->getDefaultBucket(), '/');
     if (empty($bucket)) {
         throw new InvalidDomainNameException('An empty bucket name was given');
     }
     if ($expiration) {
         $command = $this->client->getCommand('GetObject', ['Bucket' => $bucket, 'Key' => $object]);
         return $this->client->createPresignedRequest($command, $expiration)->getUri()->__toString();
     } else {
         return $this->client->getObjectUrl($bucket, $object);
     }
 }
开发者ID:GMBN,项目名称:aws-sdk-php-zf2,代码行数:23,代码来源:S3Link.php

示例9: getPublicPersistentResourceUri

 /**
  * Returns the web accessible URI pointing to the specified persistent resource
  *
  * @param \TYPO3\Flow\Resource\Resource $resource Resource object or the resource hash of the resource
  * @return string The URI
  * @throws Exception
  */
 public function getPublicPersistentResourceUri(Resource $resource)
 {
     if ($this->baseUri != '') {
         return $this->baseUri . $this->getRelativePublicationPathAndFilename($resource, TRUE);
     } else {
         return $this->s3Client->getObjectUrl($this->bucketName, $this->keyPrefix . $this->getRelativePublicationPathAndFilename($resource, TRUE));
     }
 }
开发者ID:sebids,项目名称:flow-aws-s3,代码行数:15,代码来源:S3Target.php

示例10: find

 /**
  * @param $namespace
  * @param $filter
  * @return array
  */
 public function find($namespace, $filter)
 {
     $pattern = self::buildPattern($filter);
     $iterator = $this->s3Client->getIterator('ListObjects', ['Bucket' => $this->basePath, 'Prefix' => Utils::normalizePath($this->relativePath . '/' . $namespace)]);
     $results = [];
     foreach ($iterator as $object) {
         if (!$pattern || preg_match($pattern, '/' . strtr($object['Key'], '\\', '/'))) {
             $url = $this->s3Client->getObjectUrl($this->basePath, $object['Key']);
             $results[$url] = new \SplFileInfo($url);
         }
     }
     return $results;
 }
开发者ID:ondrs,项目名称:upload-manager,代码行数:18,代码来源:S3Storage.php

示例11: getFileUrl

 /**
  * @inheritdoc
  */
 public function getFileUrl(File $file, array $options)
 {
     return $this->client->getObjectUrl($this->bucket, $this->createFilePath($file));
 }
开发者ID:nordsoftware,项目名称:lumen-file-manager,代码行数:7,代码来源:S3Adapter.php

示例12: getObjectUrl

 /**
  * Returns the URL for an object saved on Amazon S3.
  *
  * @param string $path
  *
  * @return string
  */
 protected function getObjectUrl($path)
 {
     return $this->storage->getObjectUrl($this->bucket, $path, 0, $this->getOptions);
 }
开发者ID:networksoft,项目名称:seekerplus.com,代码行数:11,代码来源:AwsS3Resolver.php

示例13: url

 /**
  * Return the url for a file upload.
  *
  * @param string $styleName
  *
  * @return string
  */
 public function url($styleName)
 {
     return $this->s3Client->getObjectUrl($this->attachedFile->s3_object_config['Bucket'], $this->path($styleName), null, ['PathStyle' => true]);
 }
开发者ID:a7madev,项目名称:stapler,代码行数:11,代码来源:S3.php

示例14: getUrl

 /**
  * Get remote url, return false in case of error
  *
  * @param string $path Remote Path with folder
  *
  * @return string
  */
 public function getUrl($path)
 {
     return $this->clientS3->getObjectUrl($this->bucket, $path);
 }
开发者ID:naturalweb,项目名称:filestorage,代码行数:11,代码来源:S3Storage.php

示例15: getUrl

 /**
  * @param $key
  * @return mixed
  */
 public function getUrl($key)
 {
     $this->service->getObjectUrl($this->bucket, $key);
 }
开发者ID:mindgruve,项目名称:derby,代码行数:8,代码来源:AmazonS3Adapter.php


注:本文中的Aws\S3\S3Client::getObjectUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。