4 Replies - 851 Views - Last Post: 13 July 2012 - 10:10 AM

#1 PixelBit  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 233
  • Joined: 17-July 11

Store user avatars in a MySQL BLOB or in file system?

Posted 13 July 2012 - 09:46 AM

I'm wondering which would be the best option, I'm not very familiar with the BLOB datatype in MySQL, I've read a little up on it, but I'm still not 100% sure which would be better, I've read good arguments for both. What do you guys think?

Cheers,
~Jamal
Is This A Good Question/Topic? 0
  • +

Replies To: Store user avatars in a MySQL BLOB or in file system?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9218
  • View blog
  • Posts: 34,612
  • Joined: 12-June 08

Re: Store user avatars in a MySQL BLOB or in file system?

Posted 13 July 2012 - 09:58 AM

I prefer to keep the files uniquely named in a folder on the file system... and not serialized in the database.. and if I have to keep them in the DB I make sure to keep them in a separate table connected by a unique id to the index table that holds all the searchable info.
Was This Post Helpful? 1
  • +
  • -

#3 PixelBit  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 233
  • Joined: 17-July 11

Re: Store user avatars in a MySQL BLOB or in file system?

Posted 13 July 2012 - 10:02 AM

View Postmodi123_1, on 13 July 2012 - 09:58 AM, said:

I prefer to keep the files uniquely named in a folder on the file system... and not serialized in the database.. and if I have to keep them in the DB I make sure to keep them in a separate table connected by a unique id to the index table that holds all the searchable info.


OK thanks, so if I saved the avatars into a file system with a unique id (just incrementing through the numbers from one), and then from within the MySQL database I had the ID of the photo associated with that account and then pulled it out of the file system using that ID and the path, to which has been specified in the config, that would be an OK system?

~Jamal
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9218
  • View blog
  • Posts: 34,612
  • Joined: 12-June 08

Re: Store user avatars in a MySQL BLOB or in file system?

Posted 13 July 2012 - 10:07 AM

Sure.. it's been done plenty of times before by folks. Smartly done by having the path in a configurable file, and just the file name/id stored in the table. (it saves time if you need to change directories.. so not changing it in a million rows but changing one config).
Was This Post Helpful? 1
  • +
  • -

#5 PixelBit  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 233
  • Joined: 17-July 11

Re: Store user avatars in a MySQL BLOB or in file system?

Posted 13 July 2012 - 10:10 AM

View Postmodi123_1, on 13 July 2012 - 10:07 AM, said:

Sure.. it's been done plenty of times before by folks. Smartly done by having the path in a configurable file, and just the file name/id stored in the table. (it saves time if you need to change directories.. so not changing it in a million rows but changing one config).



OK thanks, I've never had to do anything like this, so I just wanted to confirm. Thank you very much.

~Jamal
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1