Can anyone advise on this problem? No clue why uploaded image doesn't appear:
Things to check:
When you upload the image, check the rails log and see if there were any errors during the upload
Check the actual file in the file system or S3 depending on where you are trying to upload
Get the image URL from rails console and load it directly by using the URL
Related
In my Rails app my users can upload images via carrierwave and image magic. Works great.
Now I am trying to generate a PDF with the image so in my download.pdf.erb I have
<%= wicked_pdf_image_tag('https://s3.eu-central-1.amazonaws.com/bucketname/uploads/image/image/1/thumb_71fxg4BPTuL._SY450_.jpg') %>
In my browser I can access the URL and see the image but in my PDF file on production mode I only see a grey dot. On AWS the permission for the bucket and image are all public.
On my local server the PDF loads with the image.
Any ideas?
I solved and, although it's a workaround at might compromise the security of the app, here is what I did:
My app serves via HTTPS but still, removing the HTTPS from the S3 files solved the problem.
image_url.gsub('https','http')
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).
I am having trouble with getting uploaded images to show on a Cloud 9 rails project. When I run rails and use the included test browser I simply get a blue question mark. Calling images via their url works.
I have checked the following for help and they were unable to assist me:
How to add a image to cloud9?
Here is the code so far:
https://jsbin.com/nuduco/edit?html,output
Here is the directory structure:
Folder directory
Cloud9 IDE loads page previews over https by default. Be sure the image is being loaded over https or else you'll get a cross-origin issue. Alternatively, you can pop the preview out into a new tab and then change the preview to http.
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 am using the aws-s3 & paperclip gems to upload images from my Rails app.
The images always get uploaded correctly, and 99% of the images can be viewed fine from my web-app.
But sometimes, an image won't load. If I paste the url into the brower, I get an error:
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>value_here</RequestId>
− <HostId>
value_here
</HostId>
</Error>
I don't know why this is happening, as the same code is being used to upload every image.
When I go to the AWS console I can open the image from there fine. I can't see anything different with the images that don't work. Here's a screenshot of the permissions of one of the images that doesn't work, from what I can tell they're the same as the other images:
What is causing this problem?
Edit:
Some more detail. You can upload an image 2 ways in my app, either by file upload or by providing an image URL. Both methods work fine 99% of the time.
I get the access denied error everytime I try to upload this file by providing the url:
http://www.quadrant.org.au/img/content/Jan%20Feb%202011/True%20Grit.jpg
If I save the image to my computer, and do a file upload, it works fine.