I have nearly 1 million photos auto-incremented starting at "1".
So, I have the following:
Currently, I have all of these files in a single Ext4 linux directory.
As you can imagine, the filesystem is crazy slow.
Using PHP, how can I create an algorithm that divides up my images into a directory structure so that each directly has significantly less objects per directory.
How would I divide/modulus/implode/shift the image name (id) into a file structure like such above?
Basically, I want to create a PHP function that does the following.
- Only accept positive integers, not including 0.
- For values 1-999, return 0
- For values 1000-1999, return 1000
- For values 10,000-10,999, return 10000
- For values 25,000-25,999, return 25000