[英]AWS S3 bucket images not appearing in Rails app
After finding that some large images were not appearing in my Rails app in Heroku, I opened an AWS account in the hope that they would be shown this way. 在发现某些大图像没有出现在Heroku的Rails应用程序中之后,我开设了一个AWS账户,希望以这种方式显示它们。
I uploaded my images to my S3 bucket and I registered the keys on Heroku, as per the tutorial on the Heroku site. 按照Heroku网站上的教程,我将图像上传到了S3存储桶,并在Heroku上注册了密钥。 Everything seems to be in place, so I referred to the images using the AWS link:
一切似乎都准备就绪,因此我使用AWS链接引用了这些图像:
<img class="d-block w-100" src="https://s3-ap-southeast-
1.amazonaws.com/globalenglish1/EnglishUp-113.jpg">
But this this didn't work so I guess something is missing. 但是,这没有用,所以我猜有些东西丢失了。 The only thing that I can think it might be is that I didn't start my app in Heroku with a Procfile, and I can't find any way of creating a procfile now that I already have my app deployed to Heroku.
我唯一可以想到的是,我没有使用Procfile在Heroku中启动我的应用程序,并且由于我已经将应用程序部署到Heroku,所以找不到任何创建procfile的方法。 But I don't really know if this is necessary, it's just my guess.
但是我真的不知道这是否有必要,这只是我的猜测。
If anyone can give me any pointers, I would be most grateful. 如果有人可以给我任何指示,我将不胜感激。
As per the description provided and visiting the image source it seems that the public access has not been provided to view this image. 根据提供的描述并访问图像源,似乎未提供公共访问权限来查看该图像。
Please check for AWS console that the images stored on S3 bucket are publicly accessible or not. 请检查AWS控制台是否可以公共访问S3存储桶中存储的图像。
If not then please provide public access and then check again. 如果不是,请提供公共访问权限,然后再次检查。
For making the bucket public please find the below mentioned link. 要公开发布此存储桶,请找到以下链接。
I think the problem is you have put with space ' '
on source URL like after https://s3-ap-southeast-
it's with space see URL
from your post it's not showing Image while I put into browser, but after removing this space like This URL
it's showing image. 我认为问题是您在源URL上放置了空格
' '
,例如https://s3-ap-southeast-
之后-在空间中看到了帖子中的URL
,但当我将其放入浏览器时却没有显示图片,但是在删除了该空间之后就像This URL
它显示图像。
Check it out. 看看这个。
First You have to make bucket public and if still its not showing than check whether you have mentioned image name or not in your code 首先,您必须公开存储桶,如果仍然没有显示,请检查代码中是否提到了图像名称
val uploadObserver = transferUtility?.upload(key:"folderInBucketName/" + "FileName", file)
Note: This code is in kotlin but issue might be same 注意:此代码在kotlin中,但问题可能相同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.