简体   繁体   English

将图像从S3存储桶显示到Ruby-on-Rails应用程序中

[英]Show images from S3 bucket into Ruby-on-Rails application

I have setup an S3 bucket with name ' mobiles ' and populated it with around 2000 images. 我已经设置了一个名为“ mobiles ”的S3存储桶,并在其中填充了约2000张图像。 The bucket has a folder structure as well like ' mobiles / vendor-name / model-name / model-image.jpg '. 存储桶具有文件夹结构,例如“ mobiles / vendor-name / model-name / model-image.jpg ”。

In my rails application which I have hosted on Heroku, I want to show the list of those images against vendors and models. 在我托管在Heroku上的rails应用程序中,我想针对供应商和模型显示这些图像的列表。 How can I do that ? 我怎样才能做到这一点 ? (i mean linking them from S3 directly) (我的意思是直接从S3链接它们)

I already have saved vendors and models in Postgresql database. 我已经将供应商和模型保存在Postgresql数据库中。

I am new to RoR world so please explain the answer considering the fact. 我是RoR世界的新手,因此请考虑事实,解释答案。

Just check that every image have the right permissions. 只需检查每个图像都具有正确的权限即可。

权限

Under the properties tab of every image, you could see a link to that image. 在每个图像的属性选项卡下,您可以看到该图像的链接。

在此处输入图片说明

In your case is probably that looks like https://s3.amazonaws.com/mobiles/vendor-name/model... . 在您的情况下,可能看起来像https://s3.amazonaws.com/mobiles/vendor-name/model...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM