Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top