Retrieve the avatar for a user who provided a user ID or email address.

Signature

get_avatar( $id_or_email, $size = '96', $default = '', $alt = false )
id_or_email
 (int|string|object) A user ID, email address, or comment object
size
 (int) Size of the avatar image
Default: '96'
default
 (string) URL to a default image to use if no avatar is available
Default: ''
alt
 (string) Alternative text to use in image tag. Defaults to blank
Default: false

Return

(string) <img> tag for the user's avatar

Source

function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
	if ( ! get_option('show_avatars') )
		return false;

	if ( false === $alt)
		$safe_alt = '';
	else
		$safe_alt = esc_attr( $alt );

	if ( !is_numeric($size) )
		$size = '96';

	$email = '';
	if ( is_numeric($id_or_email) ) {
		$id = (int) $id_or_email;
		$user = get_userdata($id);
		if ( $user )
			$email = $user->user_email;
	} elseif ( is_object($id_or_email) ) {
		// No avatar for pingbacks or trackbacks
87 more lines...
WP Trac GitHub

Link here