如何在 Bluemix 的对象存储服务中访问容器中的文件?
How to access files in container in Object Storage Service in Bluemix?
- 如何通过 url 在 Bluemix 对象存储中访问文件?
- 有没有办法制作容器public?
- 如何通过键入 url 访问对象存储中的文件
在浏览器中?
- 如何通过 url 检索图像以在 html 中显示?
您可以使用 swift 命令行创建一个临时 URLs 以提供对您的对象存储文件的 public 访问。
首先你必须设置 swift CLI,你可以在这个 link 上找到步骤。
为您的环境配置 swift cli 后,您可以 运行 以下命令为您的文件创建临时 URLs:
swift stat
找到您的帐户字段(以 AUTH_ 开头)
swift post -m "Temp-URL-Key:<key>"
设置密钥
swift stat
验证密钥是否已创建
swift tempurl GET <seconds> <path> <key>
创建临时文件URL
然后您可以通过以下方式访问该文件 URL:
https://<access point>/<API version>/AUTH_<project ID>/<container namespace>/<object namespace>
对象存储文档中提供了完整的详细信息here。
最后这些命令也挽救了局面
首先使用swift并更改容器的访问控制
swift post container-name --read-acl ".r:*,.rlistings"
接下来使用 Curl 配置容器到特定的 Url 以访问文件
curl -X GET " https://<access point>/<version>/AUTH_projectID/container-name" -H "X-Auth-Token:<auth token>" -H "X-Container-Read: .r:*,.rlistings"
也非常感谢Alex da Silva提供的帮助
我在这里写了评论:
Public URLs For Objects In Bluemix Object Storage Service
BlueMix 仍在使用 swift 但 S3 API 是最可靠的。
所以回答你的问题:
How can I access files by url in Bluemix Object Storage?
上传图像后(例如),您必须使用可以访问您的图像并使其成为 public 的工具(它会在对象的属性中添加一个 public acl ).例如,您可以使用 Cloudberry 或 S3 浏览器,并使用功能“make public”。
Is there a way to make the container public?
您的 contenair 将在 bluemix 中 运行,但该服务可以创建 public URL。是的。
How can I access the file in Object Storage just by typing the url in the browser?
这是我在我的对象存储中制作的图像示例 public:
https://s3-api.dal-us-geo.objectstorage.softlayer.net/mourad-bucket-rasp-1/OBAMA.jpg
在将 acl 添加到 "public read" 后,您可以使用任何浏览器执行此操作
(同样,如果您使用 python 和 boto3 sdk,请在此处查看我的 post:Public URLs For Objects In Bluemix Object Storage Service)
How can I retrieve an image by url to display it in html?
有几种方法可以做到这一点,因为它现在有一个 public Url 并且 ul 的第一部分不会改变,只有你的对象的名称会改变,只需调用你的 URL 使用变量(如存储桶、名称等)
完整的 API 参考已经发布,它是 Here
- 如何通过 url 在 Bluemix 对象存储中访问文件?
- 有没有办法制作容器public?
- 如何通过键入 url 访问对象存储中的文件 在浏览器中?
- 如何通过 url 检索图像以在 html 中显示?
您可以使用 swift 命令行创建一个临时 URLs 以提供对您的对象存储文件的 public 访问。
首先你必须设置 swift CLI,你可以在这个 link 上找到步骤。
为您的环境配置 swift cli 后,您可以 运行 以下命令为您的文件创建临时 URLs:
swift stat
找到您的帐户字段(以 AUTH_ 开头)
swift post -m "Temp-URL-Key:<key>"
设置密钥
swift stat
验证密钥是否已创建
swift tempurl GET <seconds> <path> <key>
创建临时文件URL
然后您可以通过以下方式访问该文件 URL:
https://<access point>/<API version>/AUTH_<project ID>/<container namespace>/<object namespace>
对象存储文档中提供了完整的详细信息here。
最后这些命令也挽救了局面
首先使用swift并更改容器的访问控制
swift post container-name --read-acl ".r:*,.rlistings"
接下来使用 Curl 配置容器到特定的 Url 以访问文件
curl -X GET " https://<access point>/<version>/AUTH_projectID/container-name" -H "X-Auth-Token:<auth token>" -H "X-Container-Read: .r:*,.rlistings"
也非常感谢Alex da Silva提供的帮助
我在这里写了评论: Public URLs For Objects In Bluemix Object Storage Service BlueMix 仍在使用 swift 但 S3 API 是最可靠的。
所以回答你的问题:
How can I access files by url in Bluemix Object Storage?
上传图像后(例如),您必须使用可以访问您的图像并使其成为 public 的工具(它会在对象的属性中添加一个 public acl ).例如,您可以使用 Cloudberry 或 S3 浏览器,并使用功能“make public”。
Is there a way to make the container public?
您的 contenair 将在 bluemix 中 运行,但该服务可以创建 public URL。是的。
How can I access the file in Object Storage just by typing the url in the browser?
这是我在我的对象存储中制作的图像示例 public: https://s3-api.dal-us-geo.objectstorage.softlayer.net/mourad-bucket-rasp-1/OBAMA.jpg 在将 acl 添加到 "public read" 后,您可以使用任何浏览器执行此操作 (同样,如果您使用 python 和 boto3 sdk,请在此处查看我的 post:Public URLs For Objects In Bluemix Object Storage Service)
How can I retrieve an image by url to display it in html?
有几种方法可以做到这一点,因为它现在有一个 public Url 并且 ul 的第一部分不会改变,只有你的对象的名称会改变,只需调用你的 URL 使用变量(如存储桶、名称等)
完整的 API 参考已经发布,它是 Here