Posted By

JackWH on 06/16/10


Tagged

php image Gravatar


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

BrianCoyDesign
karp13
wizard04


Fetch a Gravatar Image


 / Published in: PHP
 

Just set the variable $email to the user's email address. Hey presto! A Gravatar image!

You can also change the size by adjusting the s=32 variable. Size is in pixels.

  1. <?php
  2. $gravatar_link = 'http://www.gravatar.com/avatar/' . md5($email) . '?s=32';
  3. echo '<img src="' . $gravatar_link . '" alt="gravatar"/>';
  4. ?>

Report this snippet  

You need to login to post a comment.