# 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?

-
Is the code output for the gravatars right ? maybe you have some other function that is filtering this . also - what you mean the image is only 50x50 ? the ORIGINAL is only 50x50 , or the output one ? –  user13279 Feb 9 '12 at 0:27
The image that it returns is only 50x50. It returns an image called bpthumb.jpg. If I go the user profile, the avatar there is 150x150 and is called bpfull.jpg. I'm just not sure how to get the full one instead. –  Kyle Feb 9 '12 at 0:32

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();
}
}

-
+1 for the function, but why didn't you simply use the bp_post_author_avatar-filter and attach a callback? Or is this your custom filter name? –  kaiser Nov 23 '12 at 18:14

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 .

-
Is there a way for me specify the user that the avatar belongs to in the function? I tried placing it within my posts and it's just blank. –  Kyle Feb 9 '12 at 0:57
Like I said, I am not a bp expert. BP is different from normal wordpress because it has many custom functions. but try to look at my edit –  user13279 Feb 9 '12 at 1:15

If you want you can take a look at this post..

http://clubkoncepto.com/wordpress-integrating-get_avatar-function-with-timthumb-php-script

-
An answer should be more than a link to an external site. –  toscho Apr 1 '12 at 1:27