As per http://drupal.org/node/29052#comment-43811, storing thousands of images in a single directory (files/images) will result in a slowdown of file system calls. I propose that images be stored in hashed directories after upload. There should be an option under "File paths" on admin/settings/image to enable or disable hashed directory creation.
You could use a basic ELF hash to determine the path based on image name. Sample code:
function hashpath($name) {
$ulHash = 0;
for ($i=0; $i < strlen($name); $i++) {
$ulHash = ( $ulHash << 4 ) + ord(substr($name, $i, 1));
if ( $g = $ulHash & 0xF0000000 ) {
$ulHash ^= $g >> 24;
}
$ulHash &= ~$g;
}
$iChar0 = $ulHash & 15;
$ulHash = $ulHash >> 4;
$iChar1 = $ulHash & 15;
$ulHash = $ulHash >> 4;
$iChar2 = $ulHash & 15;
$ulHash = $ulHash >> 4;
$iChar3 = $ulHash & 15;
return sprintf("/%x/%x/%x/%x/%s", $iChar0, $iChar1, $iChar2, $iChar3, $name);
}
My company needs this functionality in order to use image.module. Would you be interested in this addition if I submitted a patch? I'd like this functionality in place so that we could take advantage of future versions of image.module.
Closed: duplicate
1.0
image.module
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.