I had successfully integrated comfortable mexican sofa CMS into an existing rails 4.1.2 application.
Now I want to upload images to heroku from s3 bucket.
Can anyone please tell the steps for that?
I had successfully integrated comfortable mexican sofa CMS into an existing rails 4.1.2 application.
Now I want to upload images to heroku from s3 bucket.
Can anyone please tell the steps for that?
Sofa is using paperclip for attachments. So first, take a look here: http://www.rubydoc.info/gems/paperclip/Paperclip/Storage/S3
Then in initializers/comfortable_mexican_sofa.rb
you'll find config.upload_file_options
. This is how you'll override defaults.
config.upload_file_options = {
:storage => :s3,
:s3_credentials => ...
}
config.upload_file_options = {
:whiny => false,
:storage => :s3,
:s3_credentials => {"access_key_id" => ENV["S3_ACCESS_KEY_ID"], "secret_access_key" => ENV["S3_SECRET_ACCESS_KEY"]},
:bucket => ENV["S3_BUCKET_NAME"],
:s3_host_name => 's3 HOST NAME',
:path => "uploaded_files/:basename.:extension",
:styles => {:thumb => "850x850>" }
}
Give styles inside the config.upload_file_options which will take exact size of an image.
Which make more sense in uploading image else image pixels may vary.
The available configuration parameters are defined in paperclip, not comfy, and more information about there meaning can be found at:
http://www.rubydoc.info/github/thoughtbot/paperclip/Paperclip/Storage/S3
Just a note: Comfy has switched from Paperclip to ActiveStorage in 2017, so the answers are somewhat outdated.