I'm generating IDs with PHP for images to store the image by ID name on my web server and store its ID in a database.
For example, this image of Queen Elizabeth on Bing has the following URL
https://bing.com/th?id=ALSTUDD054E144F1E7A2A675119C4029373B6E59D884370A650CDB6F5389ACF982A38
The image has an ID of capital letters and numbers.
How are these IDs typically generated? Are they a hash of the image's name? How does it work? Are there any common methods using PHP to generate a similar ID?
An ID can be generated multiple ways.
I think the computationally simplest way would be something like this:
To save memory, you could also store the ID as a hexadecimal number with out the 0x part. So, 20,000,000 becomes 1312D00.
You could also use a pseudo-random number generator to generate an ID - just generate a new ID every time you generate an ID that's already been used.
You could even create some "check digits" to ensure the ID being passed to the server is a valid ID; it could be as simple as generating a bunch of digits and summing them together, storing - say - the first digit of the sum as the last digit in the ID.