paolobenve / myphotoshare

MOVED TO GITLAB! --- A Web 2.0 Photo Gallery Done Right via Static JSON, Dynamic Javascript and a bit of php for sharing
15 stars 0 forks source link

Set cache subfolders number according to media number #106

Open paolobenve opened 6 years ago

paolobenve commented 6 years ago

now we are using a two-character name for cache subfolders. With many media, subfolders get too populated.

The number of characters to use for subfolders could depend on media number, so that every subfolder get the reduction and thumbnails for no more than, say, 50 media. Since every media produces 12/13 images in cache, this would correspond to about 600 images in every folder.

The formula:

ncharacters = ceil(log50(nmedia)) = ceil(ln(nmedia) / ln(50))

       n <=     50    --->   ncharacters = 1
  50 < n <=   2500    --->   ncharacters = 2
2500 < n <= 125000    --->   ncharacters = 3
...