Reputation: 381
I am trying to upload images and then display them in my app
I configure the app on Heroku to upload files to Amazon S3. I am able to upload the images to S3. I can see it at Amazon. However i am not able to display it.
I used the code:
<%= image_tag user.profile_image.avatar.url, :size => "80x80" %>
It generates the following HTML (i change img to imgtag since stackoverflow would not allow me to add this code):
<imgtag alt="Bob_dylanplanetwaves" height="80" src="http://appname-heroku/uploads/profile_image/avatar/1/bob_dylanplanetwaves.jpg"; width="80" />
http://appname-heroku/uploads/profile_image/avatar/1/bob_dylanplanetwaves.jpg doe not point to any valid image.
I tried the following with no success:
<%= image_tag user.profile_image.avatar.current_path, :size => "80x80" %>.
it generated this code:
<imgtag alt="Album-the-bootleg-series-vol-4-bob-dylan-live-1966-the-royal-albert-hall-concert" height="80" src="/images/uploads/profile_image/avatar/2/album-the-bootleg-series-vol-4-bob-dylan-live-1966-the-royal-albert-hall-concert.jpg" width="80" />
In both cases the images are not displayed
I am using CarrierWave to uplaod the file Ruby 1.9.2, Rails 3.0.3 and hosting at Heroku
Upvotes: 3
Views: 3909
Reputation: 42863
This is how your url should look:
src="http://s3.amazonaws.com/heroku_appname/amazon_bucket_name/pictures/large/20.jpg"
appname
: the name of your application in your apps which you can check in your heroku profile. amazon_bucket_name
: this needs to be the name of the bucked you created on AS3.
Upvotes: 1