Store image in database using paperclip rails plugin

I have an application that uses the Paperclip plugin to upload an image. This application should now be deployed to the host (heroku), which has a read-only file system. Can I somehow say a paper clip for storing images in a database?

+6
ruby ruby-on-rails paperclip
source share
4 answers

Check out this sample app.

http://patshaughnessy.net/2009/5/29/paperclip-sample-app-part-3-saving-file-attachments-in-a-database-blob-column

I think this is exactly what you need.

NTN

PS: saving images in db is usually a bad idea, I'm sure you can use paperclip with S3 / cloudfront (as indicated in the answers below)

+7
source share

Heroku recommends storing file downloads on s3, and provides instructions on how to do this for several Rails file plugins.

+5
source share

Rethink what you are doing. Storing images in db is usually bad. For more information see here .

ry the right to point to S3. If nothing else, think about the cost: 500 MB of database space on Heroku is $ 50 per month. On S3 it will be 15 cents.

+4
source share

S3 image submission is slow. Latencies of 0.5 to 2 s are common, which means that they should only be used for media assets.

0
source share

All Articles