Replace the below line your code
return get_avatar( get_the_author_meta( 'ID' ), 32 );
to
return get_avatar_url( get_the_author_meta( 'ID' ) );
Hope this helps.
Replace the below line your code
return get_avatar( get_the_author_meta( 'ID' ), 32 );
to
return get_avatar_url( get_the_author_meta( 'ID' ) );
Hope this helps.