From the question, I'm guessing that you just want to have a short string of text/numbers that uniquely refers to a username, an image, an URL or something similar.
A solution would be just to generate a random string and map that to the user/image/URL in your database. Here's the random string function we use. You can adjust $chars
depending on your application. It can generate a short 5-letter string like twitpic if necessary.
function randstr($length) {
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
$chooselength = strlen($chars);
$string = '';
for ($i = 0; $i < ((int) $length); $i++) {
$string .= $chars[mt_rand() % $chooselength];
}
}