Thank you for this great gem!
Here is my Dragonfly initializer:
require 'dragonfly/s3_data_store'
Dragonfly.app.configure do
plugin :imagemagick
url_format "/processed_images/:job"
secret ENV.fetch("RAILS_SECRET_KEY")
datastore :s3,
bucket_name: ENV.fetch("S3_BUCKET"),
region: ENV.fetch("S3_REGION"),
access_key_id: ENV.fetch("S3_ACCESS_KEY_ID"),
secret_access_key: ENV.fetch("S3_SECRET_ACCESS_KEY")
end
Dragonfly.logger = Rails.logger
Rails.application.config.middleware.use Dragonfly::Middleware
At the view:
The following error occurs:
Started GET "/processed_images/W1siZiIsIjQwY2MwODcxYzUzNGJiMDQyOGE5OGI3NDc5ZmNjMWY5Il0sWyJwIiwidGh1bWIiLCIxMDB4Il0sWyJwIiwicm90YXRlIiwxODBdXQ?sha=77ef3a20acf1827b" for 10.0.2.2 at 2017-02-13 08:54:15 -0200
DRAGONFLY: uid 40cc0871c534bb0428a98b7479fcc1f9 not found
DRAGONFLY: GET /processed_images/W1siZiIsIjQwY2MwODcxYzUzNGJiMDQyOGE5OGI3NDc5ZmNjMWY5Il0sWyJwIiwidGh1bWIiLCIxMDB4Il0sWyJwIiwicm90YXRlIiwxODBdXQ?sha=77ef3a20acf1827b 404
Any idea on what caused the problem?
The only way I could get it to work was by having Shrine provide the image URLs to Dragonfly, like this:
<%= image_tag Dragonfly.app.fetch_url(share_image.image_url).thumb("100x").url %>
I also had to whitelist my S3 bucket host to the Dragonfly initializer:
fetch_url_whitelist [/awakeadmin-uploads-dev\.s3\.amazonaws\.com/]
Are there any significant disadvantages to this approach?
Thank you.
Bruno Facca