Adding avatars/gravatar to a WordPress blog

You’re looking for the get_avatar function, documented here

get_avatar( $id_or_email, $size, $default, $alt )

You’ll need either a user ID, or an email to use it, something like this should do the trick:

echo get_avatar( get_comment_author_email(), 'thumbnail' );

If avatars are turned off in settings, this function will not return anything