Me again - another simple integration hack for those moving from something like UBB. In my old hacked up UBB, I had my own avatar hack (not one of the common ones floating around). At any rate, all the avatars were stored in a single directory, and they all were named "username.gif", where "username" was the account name (bob.gif, dumbass.gif, etc.). If you have avatars for folks who have spaces in their username, and you've replaced them with underscores (john_doe.gif), this script will handle that, too.
Backup your customavatar table first. If you hose it with this script, don't cry to me....you've been warned. :p
This is a perl script - to be run from the directory containing your avatars:
# Okay, grab the user ID from the database that matches this user
$quoted_username = $dbh->quote($username);
$sth = $dbh->prepare("SELECT userid FROM user WHERE username = $quoted_username");
$sth->execute;
# Insert the user's original avatar into the customavatar table
$q = "INSERT into customavatar (userid,avatardata,dateline,filename) VALUES ($user_id, $quoted_bindata, $currtime, $quoted_filenam
e)";
$sth = $dbh->prepare($q);
$sth->execute || print "ERROR INSERTING ROW!\n";
$sth->finish;
}
exit;
Paste this into a script, chmod 755, and run it from the directory containing your avatars.
You may need to play with a bit to work with your directory of avatars - every hacked-up UBB (or whatever) is different. But it should be a good start at least ...