I am using Ruby, or more specifically the Ramaze framework with the Sequel ORM. So please don't tell me about the Paperclip gem, as it is only compatible with ActiveRecord.
With that in mind, how can I store an image in a database using Ruby and Sequel?
require "sequel"
DB = Sequel.sqlite
DB.create_table :images do
primary_key :id
String :name
File :data
end
images = DB[:images]
images.insert(name: 'foo', data: Sequel.blob(File.read('/mydir/myimage.jpg')))
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