调整php的行为改变(非常具体的问题)

I am running a Wordpress instalation. It is pulling gravatar user details and pics and using this information to populate my site front page (specific category (diaries) where this is desired). It replaces the featured image and place the gravatar of the author. A month ago, i started using cache for all of the gravatar images (wich work great on comments), but is not having effect on the pictures that loads on the front page. The code prevents the images coming from the cache and pulls at every request from gravatar. The cache folder is in "/wp-content/uploads/fv-gravatar-cache". this cache is generated by a plugin (fv gravatar cache) And this is the code (is part of the funtions.php file in a child theme):

add_filter('post_thumbnail_html', 'author_gravatar_featured_image_in_diaries', 90, 5);
function author_gravatar_featured_image_in_diaries($html, $post_id, $post_thumbnail_id, $size, $attr) {

    $id = get_post_thumbnail_id();
    $src = wp_get_attachment_image_src($id, $size);
    $alt = get_the_title($id);
    //$class = $attr['class'];

        $author_id = get_post_field ('post_author', $post_id);
        $email = get_the_author_meta( 'user_email', $author_id );
        $fname = get_the_author_meta('first_name', $author_id );
        $lname = get_the_author_meta('last_name', $author_id );
        $profile_img = esc_url( get_avatar_url($email) );

    if ( in_category( 'diaries', $post_id) || post_is_in_descendant_category( 4 ) ) {
        $html = '<img src="' . $profile_img . '" alt="' . $fname . $lname . '" />';
    }

    return $html;
}

Please, help me to change the behavior of this. I would like the image to be loaded from the folder and not from the gravatar.com site. The images are named using the user-id (with is not the email address, but a alfanumeric name of 20 characters + .jpg) (e.x= 0172b97fa46359d13c3c69a376d2aeabx192.png)

Thanks in advance!