goofball
Chevereto Noob
I have the file naming method for uploaded pictures set to "random number". (Dashboard, Image Upload, File Naming Method)
but the filenames are too long. like 13w49up9ath2ejrjfewxn5xwp6xpf3hc.jpg
I think the string does not have to be 32 characters long. here's why.
when a character can be a-z (lowercase) or 0-9, there are 26+10=36 possibilities.
so when a string is 32 characters long, that means the number of possible combinations is 32 to the 36th power, or something like the number of grains of sand in the universe.
the string doesn't have to be that long.
how long should it be? 5 characters? 10? 15? 20?
well however long the string is, it will always be to the 36th power. so it's easy to see what this is going to look like.
1^36 = 1
2^36 = 68,719,476,736
3^36 = 150,094,635,297,000,000
4^36 = 4,722,366,482,870,000,000,000
so when the string is only 4 characters long, there are more than 4 sextillion possible combinations. nobody is ever going to randomly make the same filename.
I would think that only 2 characters are good enough, having 68 billion combinations. but that would simply look inadequate having pictures named y3.jpg or 5w.jpg
a short string, like 5 characters long, should work just fine and look okay too. like 4ld7n.jpg
I looked for a random character generator in the code, and i think I found it in /app/lib/chevereto.js and chevereto.min.js
all the way at the end it says:
// Queuezier!
CHV.fn.queuePixel = function() {
var img = '<img data-content="queue-pixel" src="'+ PF.obj.config.base_url + '?queue&r=' + PF.fn.generate_random_string(32) +'" width="1" height="1" alt="" style="display: none;">';
$("body").append(img);
};
so I changed PF.fn.generate_random_string(32) to PF.fn.generate_random_string(5) but still got filenames 32 characters long.
how do you change the length of the random string?
but the filenames are too long. like 13w49up9ath2ejrjfewxn5xwp6xpf3hc.jpg
I think the string does not have to be 32 characters long. here's why.
when a character can be a-z (lowercase) or 0-9, there are 26+10=36 possibilities.
so when a string is 32 characters long, that means the number of possible combinations is 32 to the 36th power, or something like the number of grains of sand in the universe.
the string doesn't have to be that long.
how long should it be? 5 characters? 10? 15? 20?
well however long the string is, it will always be to the 36th power. so it's easy to see what this is going to look like.
1^36 = 1
2^36 = 68,719,476,736
3^36 = 150,094,635,297,000,000
4^36 = 4,722,366,482,870,000,000,000
so when the string is only 4 characters long, there are more than 4 sextillion possible combinations. nobody is ever going to randomly make the same filename.
I would think that only 2 characters are good enough, having 68 billion combinations. but that would simply look inadequate having pictures named y3.jpg or 5w.jpg
a short string, like 5 characters long, should work just fine and look okay too. like 4ld7n.jpg
I looked for a random character generator in the code, and i think I found it in /app/lib/chevereto.js and chevereto.min.js
all the way at the end it says:
// Queuezier!
CHV.fn.queuePixel = function() {
var img = '<img data-content="queue-pixel" src="'+ PF.obj.config.base_url + '?queue&r=' + PF.fn.generate_random_string(32) +'" width="1" height="1" alt="" style="display: none;">';
$("body").append(img);
};
so I changed PF.fn.generate_random_string(32) to PF.fn.generate_random_string(5) but still got filenames 32 characters long.
how do you change the length of the random string?