Using Gravatar Without Plugin by Connor Wilson

Connor Wilson has published nice post. He wrote about how to make gravatar without plugin and I’ll share for you. First, add this script to your comments page.

1
2
3
4
5
6
7
<?
$email = ""; //email that user use in gravatar
$default = ""; // link to your default avatar or if user doesn't have gravatar
$size = 40; // size in pixels squared
$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=
  ". md5($email) . "&default=" . urlencode($default) . "&size=" . $size;
?>

Then call it gravatar on tag <img src”"> like this:

1
<img src="<?=$grav_url ?>" height="<?=$size ?>" width="<?=$size ?>" alt="User Gravatar" />

Put it on each comments. That’s all.. Easy right.. hehe.

Thx Connor. I’ll use it on my current project with Code Igniter.



Related Post:

  • No Related Post

Post a Comment

Your email is never published nor shared. You're allow to say what you want...

Blogroll Link Update
Warning: Unknown: write failed: Disk quota exceeded (122) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0