I'm trying to use the default_url in my application but I store the images using S3. I'm not sure what URL I need to put in there or if I have to create a fake image just to get everything up there.
Since my images always render through S3, I don't know if it would work if I just put in some default images in my public folder. It doesn't seem to be working now - I also only have one image in there, and I know it has to resize. I can manually put the resized images in there but I'm still not sure what URL to use with default. Please help :)
I use paperclip with S3 with default images in the public folder. It works fine. My default_url statement looks like this:
:default_url => '/images/:attachment/missing_:style.png'
which means that for my attachment named avatar, setup with the styles small and large, I must create and put these images in the public dir:
It's pretty well documented.
For your reference, or in the case the problem is really somewhere else, here is my full paperclip statement:
has_attached_file :avatar,
:styles => { :small => '60x60#', :large => '300x300#' }, :default_style => :large,
:storage => :s3,
:default_url => '/images/:attachment/missing_:style.png',
:path => "users/:id/avatar/:style.:extension",
:bucket => "bucket name",
:s3_credentials => {
:access_key_id => "access key id",
:secret_access_key => "secret access key"
},
:url => ":s3_alias_url", # These two are only required when you alias S3 - e.g. want to use cdn.example.com rather than s3.amazonaws.com
:s3_host_alias => "my.aws.alias"
try this out:
:default_url => ActionController::Base.helpers.asset_path('missing.png')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With