Tuesday, September 25, 2012

Member Switch Profile Image To Avatar Script.

This conditional "IF" statement can become very usefull for you blog creators out there who want to build on your members resources.
    First we want to check if the member has uploaded a PROFILE-IMAGE and IF they have not, then we will show our own in house AVATAR-IMAGE.


<?php
  if($result['mempic']!=' ')  //THE DATA OF IMAGE PATH STORED IN YOUR DB//
  {
    echo '<img src="'.htmlentities($result['mempic'], ENT_QUOTES, 'UTF-8'),'"alt="Avatar" style="max-width:100px;max-height:100px;" />';
  }
  else
  {                                //ALTERNATE AVATAR-IMAGE PATH HERE//
    echo '<img src="img/avatar.png" alt="Avatar" style="max-width:100px;max-height:100px;" />';
  }
     ?>

 THE     (  !=  ) IS  IF MEMPIC  (does-not-  "!"  equal  "="   'emty'     "  '  '  "
       {
     SHOW THE MEMBERS PIC.
       }
     ELSE
       {
     SHOW AVATAR AS REPLACEMENT.
       }
?>
CONTINUE WITH SCRIPTS---->

No comments:

Post a Comment