0

I'm trying to use Paperclip and Amazon S3 for photo management in my Rails app, and I'm really close, but one issue: the link being created is wrong. When I right-click on a broken image I see this URL:

http://s3.amazonaws.com/anymarket/products/photos/000/000/008/medium/Screenshot_2014-07-29_at_7.53.40_PM.png?1406688226

Which doesn't work. But if I change the url to this it DOES work:

http://anymarket.s3.amazonaws.com/products/photos/000/000/008/medium/Screenshot_2014-07-29_at_7.53.40_PM.png?1406688226

Is there an easy way to change this?

Tom Maxwell
  • 9,273
  • 17
  • 55
  • 68

1 Answers1

0

This will help: Setting up bucket's name placed domain-style (bucket.s3.amazonaws.com) with Rails and Paperclip


Paperclip

Looking at the docs, it seems you have the choice of either :s3_domain_url or :s3_path_url. For you, I'd recommend the path url:

# config/initializers/paperclip.rb
Paperclip::Attachment.default_options[:url] = ":s3_path_url"

This will set the S3 path as required

Community
  • 1
  • 1
Richard Peck
  • 76,116
  • 9
  • 93
  • 147