RogerB Posted April 3, 2009 Report Share Posted April 3, 2009 I want to have a default avatar if the user doesn't have one selected, i have tried several different things to no avail ...... Something like this...Although it is not finished... Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted April 3, 2009 Administrators Report Share Posted April 3, 2009 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.. Quote Link to comment Share on other sites More sharing options...
pouzo Posted April 27, 2009 Report Share Posted April 27, 2009 I changed it but still, how is it going to find to my defualt picture Quote Link to comment Share on other sites More sharing options...
RogerB Posted April 28, 2009 Author Report Share Posted April 28, 2009 you put your image in this line: echo '<img src="'.SITE_URL.YOUR_IMAGE_GOES_HERE.'/'.$pilotcode.'.png'.'" alt="No Avatar" /> '; Quote Link to comment Share on other sites More sharing options...
novamix Posted April 28, 2009 Report Share Posted April 28, 2009 sustituye http://fac-virtual.com/noavtar.png for url your image. excuse my english <?php if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png')) { echo '<img src="http://fac-virtual.com/noavatar.png" alt="No Avatar" />'; } else { echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" alt="No Avatar" /> '; } ?> Quote Link to comment Share on other sites More sharing options...
pouzo Posted April 28, 2009 Report Share Posted April 28, 2009 I did what you told me but it didnt work Quote Link to comment Share on other sites More sharing options...
RogerB Posted April 28, 2009 Author Report Share Posted April 28, 2009 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" /> '; } ?> Quote Link to comment Share on other sites More sharing options...
pouzo Posted April 29, 2009 Report Share Posted April 29, 2009 I did what you told me but still not working, do i put the folder name and image or the full link or only image Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted April 30, 2009 Administrators Report Share Posted April 30, 2009 You shouldn't change that else { } statement, that'll break. I think you meant that in the first one Quote Link to comment Share on other sites More sharing options...
pouzo Posted April 30, 2009 Report Share Posted April 30, 2009 Can you please give me the full Code that i need to replace in The Profile.tpl Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted April 30, 2009 Administrators Report Share Posted April 30, 2009 It should be the code that novamix posted Quote Link to comment Share on other sites More sharing options...
loplo Posted October 12, 2009 Report Share Posted October 12, 2009 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? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 12, 2009 Administrators Report Share Posted October 12, 2009 Take a look at the source and see what that URL comes out to Quote Link to comment Share on other sites More sharing options...
loplo Posted October 12, 2009 Report Share Posted October 12, 2009 The output HTML looks like this: <td valign="top" align="center"> <img src="http://www.ivao.ro/blueair/lib/avatars/JOR001.png"/> <br/> <br/> <img src=""/> </td> Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 12, 2009 Administrators Report Share Posted October 12, 2009 What about for someone who doesn't have an avatar? Quote Link to comment Share on other sites More sharing options...
loplo Posted October 12, 2009 Report Share Posted October 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 12, 2009 Administrators Report Share Posted October 12, 2009 Well, there's a blank <img alt="" src=""/> sitting there - what's the full code for that, which you put into the template? Quote Link to comment Share on other sites More sharing options...
loplo Posted October 12, 2009 Report Share Posted October 12, 2009 I did not alter the template. Same thing appears with "Crystal". Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 13, 2009 Administrators Report Share Posted October 13, 2009 You have to modify the template with what Roger posted, off the top of my head. Quote Link to comment Share on other sites More sharing options...
loplo Posted October 13, 2009 Report Share Posted October 13, 2009 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. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 13, 2009 Administrators Report Share Posted October 13, 2009 That should work, can you got paste2.org, and paste the entire template in, and then send the URL? Quote Link to comment Share on other sites More sharing options...
loplo Posted October 13, 2009 Report Share Posted October 13, 2009 I think it will be better if I give you a ftp user/pass so you can test it dight on server. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 13, 2009 Administrators Report Share Posted October 13, 2009 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. Quote Link to comment Share on other sites More sharing options...
loplo Posted October 14, 2009 Report Share Posted October 14, 2009 paste2.org was blocked by my antivirus/firewall. Pasted the code @ http://pastebay.com/61048 Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 14, 2009 Administrators Report Share Posted October 14, 2009 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 Quote Link to comment Share on other sites More sharing options...
loplo Posted October 14, 2009 Report Share Posted October 14, 2009 It worked. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.