require 'dragonfly' require 'dragonfly/s3_data_store' # Configure Dragonfly.app.configure do plugin :imagemagick protect_from_dos_attacks true secret '201403152307...' url_format "/media/:job/:name" datastore :s3, bucket_name: ENV['S3_BUCKET_NAME'], access_key_id: ENV['S3_ACCESS_KEY_ID'], secret_access_key: ENV['S3_SECRET_ACCESS_KEY'], region: ENV['S3_REGION'] end # Logger Dragonfly.logger = Rails
![Heroku + Railsな環境で、Dragonflyを使って画像を動的にリサイズする (with Amazon S3/CloudFront) - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/e0c6add69a506889feef2190aea2ea9c942c6714/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-412672c5f0600ab9a64263b751f1bc81.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTk3MiZoPTM3OCZ0eHQ9SGVyb2t1JTIwJTJCJTIwUmFpbHMlRTMlODElQUElRTclOTIlQjAlRTUlQTIlODMlRTMlODElQTclRTMlODAlODFEcmFnb25mbHklRTMlODIlOTIlRTQlQkQlQkYlRTMlODElQTMlRTMlODElQTYlRTclOTQlQkIlRTUlODMlOEYlRTMlODIlOTIlRTUlOEIlOTUlRTclOUElODQlRTMlODElQUIlRTMlODMlQUElRTMlODIlQjUlRTMlODIlQTQlRTMlODIlQkElRTMlODElOTklRTMlODIlOEIlMjAlMjh3aXRoJTIwQW1hem9uJTIwUzMlMkZDbG91ZEZyb250JTI5JnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnR4dC1jb2xvcj0lMjMxRTIxMjEmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9NTYmcz05MWM5MDNmNTJhZjc1Nzc0NjA1YzhiZGU3MDg4ZTcxZg%26mark-x%3D142%26mark-y%3D57%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZoPTc2Jnc9NzcwJnR4dD0lNDBzaGltYmFjbyZ0eHQtY29sb3I9JTIzMUUyMTIxJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTM2JnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnM9OTNjZDM4MTY1ZTNkOTM3MjMzYzE4YWYxMmZkMzE0MTk%26blend-x%3D142%26blend-y%3D486%26blend-mode%3Dnormal%26s%3D5444254b1439c316ba9f56c2219c169c)