PDA

View Full Version : avatar check


bharvey42
03-13-2003, 01:50 AM
I have a customized avatar system that stores custom avatars as the users username.gif

Now In the postbit template I would like to be able to display that avatar

$userinfo[username].gif when I use this i get a broken link if the user hasn't uploaded there avatar yet. I made it so it would load a transparent gif and stuck the gif into a table as a background but it repeats if it isn't 66x64.

So what would be the best way to check if the file exists and display it and if not just display the transparent image and fill where the avatar would be?

Thanks

mr e
03-13-2003, 02:24 AM
try this, in admin/functions.php find

// do posts from ignored users

and above it do

if(getavatarurl($bbuserinfo['userid'] != "") {
$useravatar = "<img src=\"$bbuserinfo[username].gif\">";
} else {
$useravatar = "<img src=\"transparent.gif\" width=\"66\" height=\"64\">";
}


then put $useravatar in your postbit, not sure if it'll work though :)

bharvey42
03-13-2003, 09:26 PM
the avatarurl in vB is always going to be null so i don't think that is going to work?

I need to see if the file exsists and if not display the clear.gif

mr e
03-13-2003, 10:51 PM
it won't be null if they've uploaded an avatar, that's what you want right? if they've uploaded one, then display it, otherwise display clear.gif?

bharvey42
03-14-2003, 12:48 AM
yeah that is what i want but like i said the avatar is saved as the users name.

It's not uploaded via vB so it won't be stored in the vB db

mr e
03-14-2003, 02:25 AM
so it's stored in a folder on your server as their username?

bharvey42
03-14-2003, 08:59 PM
yeah the file would be stored as

like

main/images/avatars/username.gif

bharvey42
03-16-2003, 11:23 PM
bumppity bump

bharvey42
03-25-2003, 06:24 PM
anybody?