Use the SHA1 hash of the original file to create a path like so:
cache/thumbs/[1st 2 chars of hash]/[rest of hash]_[size].jpg
This allows for using symlinks in the album folder to put a picture in multiple folders without
creating duplicate cache entries. A use case of this would be using a symlink farm as a tagging
system or alternate layout in the album directory.
It will also scale better with extreme amounts of pictures since it won't just drop thousands of
files in the same directory.
Even though the thumbnails themselves will have hashes as filenames, optimally, the URLs used to access them should still be readable filenames. It follows then that the javascript will have to translate the URL into the correct file hash before displaying it.
Use the SHA1 hash of the original file to create a path like so:
cache/thumbs/[1st 2 chars of hash]/[rest of hash]_[size].jpg
This allows for using symlinks in the album folder to put a picture in multiple folders without creating duplicate cache entries. A use case of this would be using a symlink farm as a tagging system or alternate layout in the album directory.
It will also scale better with extreme amounts of pictures since it won't just drop thousands of files in the same directory.
Even though the thumbnails themselves will have hashes as filenames, optimally, the URLs used to access them should still be readable filenames. It follows then that the javascript will have to translate the URL into the correct file hash before displaying it.
Mockup