NetTalk Central

Author Topic: Storing Images  (Read 5221 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Storing Images
« on: February 01, 2009, 04:16:30 AM »
Hi,
My project will have a lot of users, each user will upload a photo.
Each user will have many clientes and products, each one with its own photo.
Suppousing there will be thouthands...
Which is the best way to store the images in the server?
I think there are two ways:
1- Store them "as is", as files distributed in folders. Is there any limit in the folder quantity in the OS or the hard disk?
2- Store them in blob fields. The problem with this approach is that I cant see the images in a browse or a form if I dont make it files before, then I need a folder for each user, client, product, etc and I am close to the other option.
Any Idea of how to proceed?

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Storing Images
« Reply #1 on: February 01, 2009, 08:02:36 AM »
How many users is "a lot" ?
Folders on disk can handle > 100 000 files. But it slows the machine down to read a folder with that many files.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Storing Images
« Reply #2 on: February 02, 2009, 06:42:09 AM »
If I succed... millons <g>
-----------
Regards
Alberto

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Storing Images
« Reply #3 on: February 03, 2009, 05:06:43 AM »
Alberto,

In my previous posting you saw I rename and copy the file to a different folder.

What I actually do is I have a file with ImageNo (Unique key), so the uploaded file is copied to that ImageNo.Ext so when you want to download the file Windows automatically opens the right 'Viewer' thing to open the file, PDFs, JPGs, CSVs, DOCs, XLSs, I have not found a file type that does not work.

I also store the original file name and that is what I display on the Browse.  As for when you get to too many files like millions, maybe copy ImageNo's 1-49,999 in subfolder \1, Images 50,000 - 99,999 in subfolder \50,000, etc.

Cheers
Charl

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Storing Images
« Reply #4 on: February 03, 2009, 06:06:27 AM »
Charl,

And what happend when 2 users are uploading the same file (same name)?

Regards
Alberto
-----------
Regards
Alberto

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Storing Images
« Reply #5 on: February 03, 2009, 07:15:45 AM »
Alberto,

What's the odds of that happening at exactly the same time? 

Remember it only uploads once you press the 'Save' Button and then the file gets copied, uniquely, somewhere else and deleted right after that.  The ImageNo autoincrement uniquely any way.

I guess you can check if the file name is there and then maybe retry the form, but again, what's the odds?

Cheers
Charl

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Storing Images
« Reply #6 on: February 04, 2009, 06:44:03 AM »
if you have millions of files then you'll need a strategy for storing them.
probably a big SQL database, and a blob field in that case.

neither TPS, not the Windows directory, will handle millions of images.

Cheers
Bruce