Easiest way to store images in database on Heroku?

后端 未结 2 1379
暖寄归人
暖寄归人 2021-02-09 18:42

We have a RoR 3.2 site on Heroku using their production tier PostgreSQL database.

Our site users occasionally upload images of 0.5 - 2MB in size. For different reasons

相关标签:
2条回答
  • 2021-02-09 19:06

    I encourage you to not use your database to store images of that size.

    S3 can be backed up very effectively, and is extremely hardened. From a data loss perspective, it's effectively safer then a development postgres database plan with Heroku.

    The cost aspect is also not really best practice in this example. Although you're right they only enforce a row limit, I think it would be frowned upon to store large images (0.5 - 2mb) in the development database plan.

    Finally, the speed of a transfer to S3 from EC2 (where Heroku is hosted) is very fast due to Amazon's internal networking.

    Knowing that, I'd urge you to rethink your desire to store images of that size in a database. See this question for a more in depth analysis on the pros and cons.

    There's also a dev center article about using S3 and Heroku.

    0 讨论(0)
  • 2021-02-09 19:20

    As mentioned by others the better option would be storing images in S3 or something.

    Still Check out following link for storing image in Heroku PostgreSQL database

    Upload images in database

    0 讨论(0)
提交回复
热议问题