Jump to content

Default avatar


RogerB

Recommended Posts

  • Administrators

Replace

<img src="<?php echo SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png';?>" alt="No Avatar" /> 

 

with

<?php
		if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
		{
			echo 'No avatar';
		}
		else
		{
			echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" alt="No Avatar" /> ';
		}
		?>

Should be able to see how that works..

Link to comment
Share on other sites

  • 4 weeks later...

That is wrong captain:

<?php

        if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))

        {

            echo 'No avatar';

        }

        else

        {

            echo '<img src="'.SITE_URL.[glow=red,2,300]THIS IS WHERE YOUR IMAGE GOES[/glow].'/'.$pilotcode.'.png'.'" alt="No Avatar" /> ';

        }

        ?>

Link to comment
Share on other sites

  • 5 months later...

Hi guys,

My code looks like this:

<?php
         if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
         {
            echo '<img src="'.SITE_URL.AVATAR_PATH.'/pilotavatar.png" alt="No Avatar" />';
         }
         else
         {
            echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" alt="No Avatar" /> ';
         }
         ?>

It displays the pilotavatar.png for the pilots without avatar, but below the missing image (red X) is still there.

What to do?

Link to comment
Share on other sites

This one did not upload any avatar and that's why the default is showed.

<td valign="top" align="center">
<img alt="No Avatar" src="http://www.ivao.ro/blueair/lib/avatars/pilotavatar.png"/>
<br/>
<br/>
<img alt="" src=""/>
</td>

I didn't see any error, but one of  my testers is using Iexplorer and he gets the red X below the avatars.

Link to comment
Share on other sites

I changed in the pilot_public_profile.tpl

this:

<img src="<?php echo SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png';?>" alt="No Avatar" /> 

with this:

<?php
         if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png'))
         {
            echo '<img src="'.SITE_URL.AVATAR_PATH.'/pilotavatar.png" alt="No Avatar" />';
         }
         else
         {
            echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" alt="No Avatar" /> ';
         }
         ?>

Donno where is the bug hidden.

Link to comment
Share on other sites

  • Administrators

Thanks.

That whole "file_exist" block replaces this line:

<img src="<?php echo $userinfo->rankimage?>"  alt="" />

That's where that blank is showing up.

So just remove these lines:

<br /><br />
<img src="<?php echo $userinfo->rankimage?>"  alt="" />

And you should be ok

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...