I'm using Dragonfly and would like to have a default image that resizes in the same way present thumbnails do.
I currently have the following code, but when Dragonfly uses the fetch_file method, it tries to process a thumbnail but the resulting URL is a dead link.
if listing.image
image = listing.image.jpg
else
image = Dragonfly[:images].fetch_file('/toekomst/images/speech-bubble.png')
end
image_tag image.jpg.thumb(size).url, :class => "framed"
I can't find much help on line for this, so any hints are most appreciated! Thanks!
you need to set the config value 'allow_fetch_file' to true - requesting over the server using fetch_file is turned off by default for security (this isn't documented particularly except for here: http://markevans.github.com/dragonfly/Dragonfly/Server.html If you do this, however, you should probably turn on 'protect_from_dos_attacks' to true, again for security:
Dragonfly[:images].configure do |c|
# ...
c.allow_fetch_file = true
c.protect_from_dos_attacks = true
c.secret = "some secret here..."
end
Hope that helps
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