![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am planning to allow each user to upload as many photos as they want into their personal account space, but my problem is that I don't know WHERE to store an unknown number of images in each user account. Can I store a collection of images in the MySql database somewhere? How? Also, what are some other ways to do this? |
#3
| |||
| |||
|
|
Robert Crandal wrote: There are different ways you can do this, the more traditional way would be to have a directory where you create one directory per user (say the user name) and then store that users images there. You could also store the images in a database table |
#4
| |||
| |||
|
|
"J.O. Aho" <user (AT) example (DOT) net> wrote in message news:91i1fkFetdU1 (AT) mid (DOT) individual.net... Robert Crandal wrote: There are different ways you can do this, the more traditional way would be to have a directory where you create one directory per user (say the user name) and then store that users images there. You could also store the images in a database table In your opinion or best guess, how do you think Facebook does this? Do you think Facebook creates a directory per user where each user can upload his personal photos? |
#5
| |||
| |||
|
|
I just started learning about MySql in order to start building a website that stores a database of user information. I'm thinking that I want my database to keep track of user accounts, user profiles, and user information, etc.. etc... I am planning to allow each user to upload as many photos as they want into their personal account space, but my problem is that I don't know WHERE to store an unknown number of images in each user account. Can I store a collection of images in the MySql database somewhere? How? Also, what are some other ways to do this? yes. |
|
Thank you! |
#6
| |||
| |||
|
|
I just started learning about MySql in order to start building a website that stores a database of user information. I'm thinking that I want my database to keep track of user accounts, user profiles, and user information, etc.. etc... I am planning to allow each user to upload as many photos as they want into their personal account space, but my problem is that I don't know WHERE to store an unknown number of images in each user account. Can I store a collection of images in the MySql database somewhere? How? Also, what are some other ways to do this? Thank you! |
#7
| |||
| |||
|
|
I just started learning about MySql in order to start building a website that stores a database of user information. I'm thinking that I want my database to keep track of user accounts, user profiles, and user information, etc.. etc... I am planning to allow each user to upload as many photos as they want into their personal account space, but my problem is that I don't know WHERE to store an unknown number of images in each user account. Can I store a collection of images in the MySql database somewhere? How? Also, what are some other ways to do this? Thank you! |
#8
| |||
| |||
|
|
Also, file systems don't do well with thousands of users and hundreds of thousands of images - they just weren't made to handle that many individual files. RDBs such as MySQL, OTOH, easily handles millions of users and hundreds of millions of images. Remember- a file system is just a non-relational database. It's good for some things but not everything. |
#9
| |||||
| |||||
|
|
Jerry Stuckle wrote: Also, file systems don't do well with thousands of users and hundreds of thousands of images - they just weren't made to handle that many individual files. RDBs such as MySQL, OTOH, easily handles millions of users and hundreds of millions of images. Remember- a file system is just a non-relational database. It's good for some things but not everything. That rather depends on the filesystem. XFS will happily handle 13TB with over 10 million files - that is from personal experience. Obviously VFAT would be a bad idea, and putting *all* the files on one directory *may* be a bad idea (depends on directory hashing support in the FS) - but with a sensible layout (one dir per user, possibly with a further sublayer of user's first letters a-z) it will be fine. |
|
Couple of points IMO - and I cannot speak for MySQL in particular - but what will it do for backups? |
|
With a small database and a big filesystem of images, the DB dump will be fine and the FS can be backed up with an rsync type methodology. |
|
With a huge number of images in a DB, I suspect the possibilities of doing incremental backups are vastly reduced and your DB dump file is ging to be huge. |
|
Just my opinion, based on Postgresql - but the principles mostly apply to MySQL unless it has some particular features to help with the problems I posed. Cheers, Tim |
#10
| |||
| |||
|
|
On 4/24/2011 2:47 AM, Robert Crandal wrote: I just started learning about MySql in order to start building a website that stores a database of user information. I'm thinking that I want my database to keep track of user accounts, user profiles, and user information, etc.. etc... I am planning to allow each user to upload as many photos as they want into their personal account space, but my problem is that I don't know WHERE to store an unknown number of images in each user account. Can I store a collection of images in the MySql database somewhere? How? Also, what are some other ways to do this? Thank you! People have been using relational databases to store images for over 25 years that I'm aware of - we were doing it at IBM in the mid-80's. They store images just fine, and the more images you have, the better they do. Just use a BLOB datatype. |
|
The only downside is you can't serve the image directly from the database, but it just takes a short script do do so. Not a real big thing. There are a lot of advantages to using a database. For instance, if you just store the filename in the database, what happens when someone deletes the image? Or what if the filename is deleted from the database but the file still exists (orphaned file). |
|
Also, file systems don't do well with thousands of users and hundreds of thousands of images - they just weren't made to handle that many individual files. RDBs such as MySQL, OTOH, easily handles millions of users and hundreds of millions of images. Remember- a file system is just a non-relational database. It's good for some things but not everything. |
![]() |
| Thread Tools | |
| Display Modes | |
| |