當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。