I'm using PHP and MySQL, and don't know where to start with how to set up profile pictures.

It seems all other user data can be held in the mysql table, but I don't think I can put pictures into a mysql table. So how do profile pictures generally work?

有帮助吗?

解决方案

You can put pictures in a database (using a BLOB field), but I wouldn't, due to the performance hit.

Store the images on the filesystem with PHP, and just store the ID of the picture in the database.

其他提示

I think that what is usually done is set up an upload system for users to upload their images. You just have to link this image with the user by naming it with something like a user ID.

Then you just have to store a link to the uploaded picture in your database, this way you could also imagine allowing user to use remote images although this might not be a good idea.

But as said, the MySQL BLOB field allows storing pictures.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top