How to get larger version of author avatar

I am trying to incorporate author avatars into my posts by doing <?php echo get_avatar( get_the_author_meta('ID'), 150 ); ?> but I can’t go larger than 50x50px without it getting stretched (since the image is only 50x50px). It is using the BuddyPress thumbnail of the avatar.

How can I get it to use a larger thumbnail version or is there another function I can try?

Related posts

Leave a Reply

3 comments

  1. I found the function that makes up bp_post_author_avatar() and then changed the type to full. Place this funtion in functions.php and use the new function to call the post author avatar in the template.

    function fod_post_author_avatar() {
    global $post;
    
    if ( function_exists('bp_core_fetch_avatar') ) {
        echo apply_filters( 'bp_post_author_avatar', bp_core_fetch_avatar( array( 'item_id' => $post->post_author, 'type' => 'full' ) ) );  
    } else if ( function_exists('get_avatar') ) {
        get_avatar();
    }
    }
    
  2. I am not an expert on BuddyPress specifically, but I believe that BP has a specified function :

    <?php bp_member_avatar('type=full&amp;width=125&amp;height=125') ?>
    

    you can also ovverride by adding code to a functions file or add a file bp-custom.php to the wp-content/plugins folder to change image sizes

    Avatar specific settings can be changed:

    define ( ‘BP_AVATAR_THUMB_WIDTH’, 50 );
    define ( ‘BP_AVATAR_THUMB_HEIGHT’, 50 );
    define ( ‘BP_AVATAR_FULL_WIDTH’, 150 );
    define ( ‘BP_AVATAR_FULL_HEIGHT’, 150 );
    define ( ‘BP_AVATAR_ORIGINAL_MAX_WIDTH’, 640 );
    define ( ‘BP_AVATAR_ORIGINAL_MAX_FILESIZE’, $max_in_kb );
    define ( ‘BP_AVATAR_DEFAULT’, $img_url );
    define ( ‘BP_AVATAR_DEFAULT_THUMB’, $img_url );
    

    So try tot change those settings and see if it helps

    EDIT

    you can try to use bp_get_member_user_id() or bp_the_member() – bp has some kind of “custom-loop” that goes something like this :

    <?php if ( bp_has_members( '' ) ) : ?>
                        <?php while ( bp_members() ) : bp_the_member(); ?>
                            <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar('type=full&amp;width=125&amp;height=125') ?></a>
                        <?php endwhile; ?>
    <?php endif; ?>
    

    but in any case, try first to ovveride the defaults like described above, it will also help to identify the problem source .