Jump to content

Recommended Posts

Posted

I want to have a default avatar if the user doesn't have one selected, i have tried several different things to no avail :P......

Something like this...Although it is not finished...

pilotavatar.png

  • Administrators
Posted

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..

  • 4 weeks later...
Posted

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" /> ';

        }

        ?>

  • 5 months later...
Posted

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?

Posted

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.

Posted

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.

  • Administrators
Posted

I don't get the time to do that really. If you can paste the template, it's much faster for me to do the correction, and also makes it available for others to see.

  • Administrators
Posted

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

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...