Welcome Guest, Not a member yet? Register   Sign In
How are profile pics stored into database and retrieved?
#1

[eluser]Volkof[/eluser]
Hi there,

I was wondering how do forums and social websites like facebook store Profile Pictures?

If a user uploads his profile pic, is it saved into the database in a path format like this?

Code:
assets/images/Others/randompic.png

And then it gets retrieve with something like:

Code:
$row->profilePic
#2

[eluser]PhilTem[/eluser]
Communities like this store the image somewhere on their hard drive or a CDN. The only information they store inside the database is the path to where the image is located at. Having given this information (the path) they can display the image no matter where it resides Wink
#3

[eluser]Otemu[/eluser]
I asked a similar kind of question although not exactly the same but Cronix gave a excellent response
http://ellislab.com/forums/viewthread/219127/
#4

[eluser]Volkof[/eluser]
So this means when user upload their profile pic, the img is actually saved into the company harddrive n the path is stored in DB?
#5

[eluser]PhilTem[/eluser]
A good talk about this topic:
http://perspectives.mvdirona.com/2008/06...hotos.aspx

And it also has been discussed on SO many, many, many times:
http://stackoverflow.com/questions/56144...-a-web-app

http://stackoverflow.com/questions/76604...ystem-file

Thus: Go for file storage of the images and store just the path information in the database. Less bandwith usage and less problems that could evolve during implementation Wink
#6

[eluser]Aken[/eluser]
Depending on the situation, it's also possible that you don't even need to store the image path. You can use an already defined item, such as a user ID, username, or other unique value, and store the image using that value. Then, if you already have that identifier, you can call the image using it.

For example, my username is Aken. If I'm allowed to have a single profile photo, it could be stored as cdn.example.com/photos/profile/Aken.jpg. No reason to save this path, if the folder path is already known.

This may not be suitable for you, but it's an option.




Theme © iAndrew 2016 - Forum software by © MyBB