PHP to store images in MySQL or not?

前端 未结 16 2672
离开以前
离开以前 2020-11-28 05:56

I have built a small web application in PHP where users must first log in. Once they have logged in, I intend on showing a small thumbnail as part of their \"profile\".

16条回答
  •  一个人的身影
    2020-11-28 06:13

    We created a shop that stored images in the DB. It worked great during development but once we tested it on the production servers the page load time was far too high, and it added unneccessary load to the DB servers.

    While it seems attractive to store binary files in the DB, fetching and manipulating them adds extra complexity that can be avoided by just keeping files on the file system and storing paths / metadata in the DB.

    This is one of those eternal debates, with excellent arguments on both sides, but for my money I would keep images away from the DB.

提交回复
热议问题