我如何retreive通过CollectionFS上传到亚马逊的S3图像:S3亚马逊、图像、retreive、CollectionFS

由网友(我是我,不容复制)分享简介:在一个流星的项目,我使用 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 s...

在一个流星的项目,我使用 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.

阅读全文

相关推荐

最新文章