MyBB Community Forums

Full Version: How do I pull an avatar from the database...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Note: I am not actually angry about anything I just like the name lol...

I am trying to make a homepage for my game clan. I have the homepage under the board directory - (path to boards: /home/xxxxx/public_html/xxxx/boards) (path to hompage:/home/xxxxx/public_html/xxxx/boards/portal) - yet I still cannot get the image to show up.

First I wrapped in php tags at the top of my file after I required global.php (for log in area).

$ava = "{$mybb->user['avatar']}";

And I tried to use this to display the avatar:
<img src="<?php print $ava; ?>" alt="Avatar" title="My Avatar" width="100px" height="100px" />&nbsp;
and
<img src="<?php echo $ava; ?>" alt="Avatar" title="My Avatar" width="100px" height="100px" />&nbsp;
That did not work...so then I went a different rout and treid to get the image to show up with the person's userid.

I put this code in the php tags at the top of my file.
$uid = "{$mybb->user['uid']}";

And I tried to use this to get the avatar to show up:
<img src="http://www.blahhh.com/xxxx/boards/member.php?action=profile&amp;uid=<?echo $uid;?>" alt="Avatar" title="My Avatar" width="100px" height="100px" />&nbsp;

So I have come to the conclusion the only way to get an avatar to show up on an external page is by pulling it straight from the database somehow. I want to know if someone can give me a heads up on how to do this. My knowledge of php is extreamly limited so please bear with me...

Edit: when I say that the avatar didnt show up there I mean that there is a box w/ a red x in it...and yes I have cleared my cache and other private data several times...still no luck. Sad

Sorry if this issue has already been addressed. I used the search function but still have not been able to find anything.
Try just $uid instead of <?echo $uid;?> ?

I don't know php though.
(2009-04-19, 12:08 AM)Scoutie44 Wrote: [ -> ]Try just $uid instead of <?echo $uid;?> ?

I don't know php though.
Same result Sad. Thanks for the help anyways. Smile