show a blob image

how i can show a image stored in a blob field in my database mysql ?

this is my controller http://www.pastie.org/556814

http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M000196&name=send_data

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com

Ricardo wrote:

how i can show a image stored in a blob field in my database mysql ?

This is a FAQ, and the answer is "save yourself years of torture and agony by using Paperclip, and never again think of storing an image inside a blob". There are just so many reasons that is wrong, beginning with the simple fact that your web server will serve image files directly from your hard drive, and both of them are tuned to do this efficiently, unlike Ruby and MySQL.

I agree with Philip - definately try Paperclip and avoid using BLOB columns for file attachments.

I did some work recently on getting Paperclip to work with BLOBs; if you do need to store files in a database table for some reason (e.g. legacy data, security, etc.) then you might want to read this: http://patshaughnessy.net/2009/5/29/paperclip-sample-app-part-3-saving-file-attachments-in-a-database-blob-column

- pat