I built a rails app and set up s3 and paperclip together. So far, the images are being posted into my s3 account. But on the live app it's not actually showing the image and just showing the broken file icon.
Any ideas why this is happening? Is it a paperclip error? is it Heroku? Is it my controller?
Here's the live app: http://petaluma-marin.herokuapp.com/Nutrition-Recipes
Here's my repo: https://github.com/Gcamara14/Recipe_app
Thanks!!
Your url to the images is wrong. The URL for your second image currently is this
http://s3.amazonaws.com/recipe-app-gio/recipes/images/000/000/009/medium/Screen_Shot_2017-05-30_at_1.19.49_PM.png?1496243164
What it needs to be is this
http://s3-us-west-1.amazonaws.com/recipe-app-gio/recipes/images/000/000/009/medium/Screen_Shot_2017-05-30_at_1.19.49_PM.png?1496243164
Notice instead of http://s3.aws... at the beginning you need http://s3-us-west-1.aws...
Whenever I have issues with S3 I find it is easiest to go to the bucket and look at the path and then inspect the image or asset and see if they match.
To give you a hint about what the issue might be, in your browser if you copy/paste the url for a photo you should see this message:
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
Take a look at your paperclip_defaults. You are missing the s3_host_name that would contain something like s3-us-west-1 (as mentioned in one of the prior answers).
Also looks like there is an issue already created in the paperclip repo that should help you out (here).
Related
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.
I uploaded my images to my S3 bucket and I registered the keys on Heroku, as per the tutorial on the Heroku site. Everything seems to be in place, so I referred to the images using the AWS link:
<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. 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.
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
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.
Check it out.
I deployed my educational app in heroku(https://slobodalibrary.herokuapp.com). I've set s3 as a storage. But after some time images still disappear. What is the priobem? Where should I dig to fix it?
It looks to me like it is finding the image, but doesn't have read access, try this:
Go into your s3 bucket and make sure that your folder has read access
to all.
I want to create little ticket system : http://ticketsystemkm.herokuapp.com/
I got posters for movies to display them on main site.
When i make new movie everything works good, but after few hours images disappear.
Maybe someone had similar problem and know how to solve it.
Guessing your images are user uploads via Paperclip, or something of the like, to your public folder, which is why they're disappearing. If your app doesn't receive any traffic for 15 minutes or so, the VM it lives on is destroyed, and the public folder goes along with it.
You need to store your assets on S3, or some of other CDN. The other option is to check the relevant assets into version control into app/assets/images.
A more detailed explanation (and solution) can be found here:
https://devcenter.heroku.com/articles/paperclip-s3
Issue can happen if you change default_url of uploader or uploaded files has been deleted
You should check something:
- image path in website
- default_url in uploader
- file in that path exist
I think we cannot store files in heroku, maybe it's cleared frequently
If upload file is cleared by heroku, you should store it external(S3, Azure Storage, Google Cloud Storage, ...)
I have a rails app, in which i store some images in AWS, and show them in a PDF report. When there is no images to be shown, i show a placeholder, like this one here: .
The problem is: the image is not show in the PDF file. When in debug mode, the image is shown as usual, but never in my PDF! The link to the image is like this: https://dl.dropboxusercontent.com/u/4096865/missing.png
Edit 1:
I tried to include the image like this: image_tag("https://dl.dropboxusercontent.com/u/4096865/missing.png")
The solution i've found was simple, but prevented me from using dropbox for storage: it must be a http url. So, when i uploaded it to AWS S3, it worked!
So, this here works perfectly: image_tag("http://s3-sa-east-1.amazonaws.com/base-fisc-prod/missing.png")
This is an issue with images stored in a HTTPS link, the easiest way to solve this is to store the images in a HTTP link.
If you must store them in HTTPS, use this solution provided here
I signed up for Amazons S3 service.
I am having a problem with my Gallery script. It want the URL relative to the server where the files are located at?
So instead of http://gallery.s3.amazonaws.com/10/images
They want: /home/www/gallery.s3.amazonaws.com/10/images
The problem is I don't know what to use when it is Amazon s3?
Anybody have a solution?
Thanks.
I think you will need to specify what gallery software you are using. (Gallery 2, Gallery 3, Coppermine, Etc.) Or, are you writing your own script? If so, what language/platform?
Often, something expecting a physical path does not accept an HTTP URL unless HTTP support has been purposefully added.