Skip to content

Instantly share code, notes, and snippets.

@antulik antulik/one.rb
Created Aug 13, 2015

Embed
What would you like to do?
dragon fly helper
def thumb_url photo, size
case photo
when ImageUploader
if Rails.env.development?
path = photo.path
else
path = photo.url
end
when String
path = photo
else
raise "Unknown photo type #{photo.class}"
end
if path.starts_with? 'http'
Dragonfly.app.fetch_url(path).thumb(size).url
else
Dragonfly.app.fetch_file(path).thumb(size).url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.