Jump to content

Show No Avatar Image


in2tech

Recommended Posts

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!

Link to comment
Share on other sites

<?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 by web541
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...