我如何retreive通过CollectionFS上传到亚马逊的S3图像:S3 [英] How do I retreive an image uploaded to Amazon S3 via CollectionFS:S3

查看:275
本文介绍了我如何retreive通过CollectionFS上传到亚马逊的S3图像:S3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个流星的项目,我使用 Col​​lectionFS:S3 将图像保存到一个水桶在S3。我不能看到如何加载它们放回项目。

In a Meteor project I am using CollectionFS:S3 to save images to a bucket in S3. I'm not able to see how to load them back into the project.

我曾尝试使用FSFile.url()方法,显示下code,但它的返回: /cfs/files/images/e6jQ4Txgvb37GisEQ/imagename.jpg?token=XXX

I have tried to use the FSFile.url() method as show in the code below but it's returning: /cfs/files/images/e6jQ4Txgvb37GisEQ/imagename.jpg?token=XXX

我在等一个Amazon S3的URL在s3-eu-west-1.amazonaws.com/mybucket/myfolder/imagename.jpg

I was expecting an Amazon S3 url as in s3-eu-west-1.amazonaws.com/mybucket/myfolder/imagename.jpg

view.html:

view.html:

  {{#each images}}
    URL: {{this.url}}
    <img src="{{this.url}}" alt="thumbnail">
  {{/each}}

view.js

view.js

 images: function () {
  return images.find();
 }

所有的例子我可以在CollectionFS GitHub的页面上看到使用URL方法,以便不明白为什么我不能够访问图像。

All examples I can see on the CollectionFS github page use the url method so can't see why I'm not able to access the images.

推荐答案

这实际上是正确的。您正在从该服务器重定向到S3的正确的文件服务器的URL。

That's actually correct. You're getting a url from the server which the server redirects to the correct file on S3.

在换句话说概念性的服务器作为供应临时访问文件S3上(因此在最后的令牌)至S3的代理。

In other words conceptually the server serves as a proxy to S3 that serves temporary access to files on S3 (hence the token at the end).

如果您检查图像采集服务器端(流星壳),你会看到,它的指向在您的S3集合中的相对路径。

If you inspect the image collection server-side (meteor shell) you'll see that it's pointing to the relative path within your S3 collection.

如果它不显示图像正确还有别的事,但它应该与食物安全中心提供的URL。

If it's not displaying the image correctly there's something else going on, but it should with the url provided by cfs.

这篇关于我如何retreive通过CollectionFS上传到亚马逊的S3图像:S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆