简体   繁体   English

AWS S3存储桶映像未出现在Rails应用中

[英]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. 要公开发布此存储桶,请找到以下链接。

Make a bucket public in Amazon S3 在Amazon S3中公开存储桶

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.

相关问题 无法将图像上传到Rails中的AWS S3存储桶 - Couldnot upload images to AWS S3 bucket in Rails AWS s3从Rails应用程序访问私有存储桶URL - AWS s3 access PRIVATE bucket url from rails app 从AWS S3存储桶检索图像 - Retrieving images from AWS S3 bucket 适用于Web和移动应用程序的S3存储桶策略和Cognito AWS连接(导轨和离子) - S3 Bucket policy and Cognito AWS connection for web and mobile app (rails and ionic) 如何获取Rails应用程序的CORS标头以访问AWS S3存储桶? - How to get CORS header for rails app to access aws s3 bucket? 带有 x-amz-server-side-encryption 策略的 aws s3 存储桶中的问题不允许 rails5 上传图像,但允许在 rails4 中 - Issue in aws s3 bucket with x-amz-server-side-encryption policy not allowing rails5 to upload images but allows in rails4 用现有图像将Rails应用程序转移到Heroku。 将图像移到AWS存储桶? - Rails app to Heroku with existing images. Moving images to AWS bucket? 从 AWS S3 Bucket 获取数据文件并在 Rails 中解析? - Getting a datafile from AWS S3 Bucket and parse in Rails? 使用React和Rails上传图像-Paperclip和AWS S3存储桶 - Using React and Rails to upload image - Paperclip and AWS S3 bucket 无法上传到已部署应用程序的AWS S3存储桶 - Cannot upload to deployed app's AWS S3 bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM