[英]how to get the correct image path on amazons3
I'm using the following code to get the path of images on S3 我正在使用以下代码来获取S3上图像的路径
Storage::getDriver()
->getAdapter()
->getClient()
->getObjectUrl(env('S3_BUCKET_NAME'), $key);
this url returns BUCKETNAME.s3-eu-west-1-amazon.com/$key 此网址返回BUCKETNAME.s3-eu-west-1-amazon.com/$key
while the real url of the image is s3-eu-west-1-amazon.com/BUCKETNAME/$key 而图片的实际网址是s3-eu-west-1-amazon.com/BUCKETNAME/$key
what to do get the same url ? 如何获得相同的网址?
Amazon S3 supports 2 types of object URLs: Amazon S3支持两种类型的对象URL:
You can find more information about them here: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro 您可以在此处找到有关它们的更多信息: http : //docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro
The URL you're getting from the client should work regardless of the format. 不管格式如何,从客户端获取的URL都可以使用。 The format used depends on: 使用的格式取决于:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.