in2tech Posted June 19, 2016 Report Share Posted June 19, 2016 I want to use this code, but show the silhouette no avatar image that I have instead of just the words No Avatar: <?php if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png')) { echo 'No avatar'; } else { echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" width="300px" height="195px" alt="No Avatar" /> '; } ?> Thanks for your help! Quote Link to comment Share on other sites More sharing options...
web541 Posted June 19, 2016 Report Share Posted June 19, 2016 (edited) <?php // make sure that $pilotcode exists where you are trying to put it if(!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilotcode.'.png')) { echo '<img src="'.SITE_URL.AVATAR_PATH.'/noavatar.png'.'" alt="No Avatar" />'; } else { echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilotcode.'.png'.'" width="300px" height="195px" alt="Has Avatar" /> '; } ?> Edited June 19, 2016 by web541 Quote Link to comment Share on other sites More sharing options...
in2tech Posted June 19, 2016 Author Report Share Posted June 19, 2016 web541, Thank You very, very much! I appreciate it! It works now! 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.