1

Topic: Show the avatar in a intergrated site?

Hi!

I have intergrated punBB into my website. And now o am trying to show the avatar on a page on my page. The avatar that i want to show is that avatar where the user is the id in the parameter.

I have made it but then i can just choose a specific .jpg, .png or gif.....i need something that looks if its a gif, jpg or so....

This is what i found in profile.php

            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif'))
                $avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.gif" '.$img_size[3].' alt="" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
                $avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.jpg" '.$img_size[3].' alt="" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png'))
                $avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.png" '.$img_size[3].' alt="" />';

All help is appreciated!

Cheers... smile

2

Re: Show the avatar in a intergrated site?

I did'nt know there was a search function in this forum, but it sure was and when i tried to search after my "problem" i found several cool things called answers... smile

"You FOOL to think your are alone in the world with your problems...."...... big_smile

3

Re: Show the avatar in a intergrated site?

I never get satisfied.. sad

I use this to write out the avatar...

$avatardir = "../forum/img/avatars";
            if ($img_size = @getimagesize($avatardir.'/'.$row_gastboken['usr_inlagg'].'.gif'))
                $user_avatar = '<img src="'.$avatardir.'/'.$row_gastboken['usr_inlagg'].'.gif" alt="" border="1"/>';
            else if ($img_size = @getimagesize($avatardir.'/'.$row_gastboken['usr_inlagg'].'.jpg'))
                $user_avatar = '<img src="'.$avatardir.'/'.$row_gastboken['usr_inlagg'].'.jpg" alt="" border="1"/>';
            else if ($img_size = @getimagesize($avatardir.'/'.$row_gastboken['usr_inlagg'].'.png'))
                $user_avatar = '<img src="'.$avatardir.'/'.$row_gastboken['usr_inlagg'].'.png" alt="" border="1" />';
echo "$user_avatar";

But now i would like to show a "no avatar pic" if the user does'nt have any uploaded avatar.

I tried all kind of things but hav'nt succeded and thanks to that my hair now is grey, is that good?

I suppose that you just should make a if statement and echo either $user_avatar or and imgsrc to my "no avatar pic"? I've tried that but i dont really know what to compare $user_avatar to? How is that variable if it is empty?

Many question for a PHP beginner like me smile Maby someone of you have any answers? big_smile

Re: Show the avatar in a intergrated site?

Just add this:

else
$user_avatar = '<img src="'.$avatardir.'/noavvy.png" alt="" border="1" />';

5 (edited by pawe 2006-07-21 13:56)

Re: Show the avatar in a intergrated site?

Hehe, i have tried that one before but did get a error and i got it now with your code too.

But now i saw what i had done, the echo was before the last else statement....

Damn me... smile

but thanks again!!!! big_smile

6

Re: Show the avatar in a intergrated site?

Only with this code can I put the avatar, for example, in header.php (on <pun_status>)?

Please help me!!

Thanks.

7

Re: Show the avatar in a intergrated site?

toc toc... are someone in this thread? I need your help!

eooo! smile

Re: Show the avatar in a intergrated site?

Yes

9

Re: Show the avatar in a intergrated site?

Only yes? sad

Re: Show the avatar in a intergrated site?

I have tryed this to get it to show the users avatar after log in, but all I get is a blank page, any ideas??

heres the code im using

<?php
define('PUN_ROOT', './forum/');
require PUN_ROOT.'include/common.php';
define('PUN_QUIET_VISIT', 1);

if (!$pun_user['is_guest'])
      echo 'Hello '.pun_htmlspecialchars($pun_user['username']); 
    $avatardir = "forum/img/avatars"; {
            if ($img_size = @getimagesize($avatardir.'/'.$row_gastboken['usr_inlagg'].'.gif'))
                $user_avatar = '<img src="'.$avatardir.'/'.$row_gastboken['usr_inlagg'].'.gif" alt="" border="1"/>';
            else if ($img_size = @getimagesize($avatardir.'/'.$row_gastboken['usr_inlagg'].'.jpg'))
                $user_avatar = '<img src="'.$avatardir.'/'.$row_gastboken['usr_inlagg'].'.jpg" alt="" border="1"/>';
            else if ($img_size = @getimagesize($avatardir.'/'.$row_gastboken['usr_inlagg'].'.png'))
                $user_avatar = '<img src="'.$avatardir.'/'.$row_gastboken['usr_inlagg'].'.png" alt="" border="1" />';
    echo "$user_avatar"; }
else
{
    $redirect_url = '' ;
    if(isset($_SERVER['REQUEST_URI']))
        $redirect_url = $_SERVER['REQUEST_URI'] ;
 
    require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';

?>
            <form id="login" method="post" action="<?php echo PUN_ROOT.'login.php?action=in'; ?>">
                <input type="hidden" name="form_sent" value="1" />
                <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
                <?php echo $lang_common['Username'].' ' ?>
                <input type="text" name="req_username" size="13" maxlength="25" /> 
                <?php echo $lang_common['Password'].' ' ?>
                <input type="password" name="req_password" size="13" maxlength="16" /> 
                <input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" />                
            </form>
<?php

}