I'll have an online prescence with a lot of companies and every company will have the ability to upload their logo design. Could it be smart to just produce a folder for every company who subscribes, so it might be
companies/user1/logo design.digital and companies/user2/logo design.digital and merely store everybody inside a folder, this way I do not need the road to reference the look?

Or must i store them in a single folder like company_logos/gaegha724252.digital and they'll be random file names, and also the path could be saved within the database connected with this company?

What exactly are the pros and cons?

Thanks!

Using Folders for Organization

Advantages: They're realistically obvious to a person fiddling using the system around the back finish- that's about this really.

Disadvantages: 'harder' to wash up whenever you remove a business, etc. and you've got to make certain none of the directory names overlap, generally more work in the beginning.

Using Images in a single Folder

Advantages It's technically a little simpler to wash up and never that much work.

Disadvantages You will need to write at least a really fundamental collision recognition formula along with a very fundamental 'random title generator'.

While using Database to keep Images

Many lives happen to be lost within this argument!

Advantages: Referential integrity, copying/rebuilding now is easier, categorization

Disadvantages: Fraught with issues, potentially reduced, more complex storage/retrieval techniques, potential performance issues and increase of network demands. Also, most cheap hosting providers' databases are far too terrible with this to become a wise decision.

I highly recommend simply using a hashed file title and storing it (the filename) within the database. This ought to be much simpler over time and perform better generally without getting too complicated.

store them as "company_logos/125.digital", where 125 is definitely an unique id (primary type in your database).

Based on the number of companies you anticipate, developing a folder for every company could rapidly get absurd. Also, reading through a folder structure from disk is going to be much reduced than reading through from the database.

You can keep image location within the database, or you might make use of the ID solution. You might keep image itself within the database should you wanted, while using "blob" type. Although other questions have handled this problem: Storing Images in DB - Yea or Nay?

It might be best either to keep image title within the database, or make use of the ID method.

I'd go even more: calculate MD5 amount of each file before storing it to filesystem. You can utilize first couple of figures because the directory title of first level, next two figures as a listing of second level:

vv 1st level
61f57fe906dffc16597b7e461e5fce6d.jpg
  ^^ 2nd level

Because the a hashing formula has equal distribution, this can distribute your files equally among folders (the concept originates from how Squid organizes it's file cache). The server should return URL such as this (e.g. no notion about sites):

http://server.com/images/61f57fe906dffc16597b7e461e5fce6d.jpg

and you'll apply mod_rewrite to really rewrite this hyperlink to something similar to this:

/storage/images/61/f5/7fe906dffc16597b7e461e5fce6d.digital

This can include some extent anonymity and hide the actual image title. More over, in case your clients will plan to upload exactly the same contents, it'll finish up within the same file, that will save your valuable disc space. Beware when getting rid of the file in one client: it could also be used by others!

If it will be only a couple of hundred records approximately, I would not bother storing the photos outdoors the db.