문제

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