Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

How to increase activity-avatar image size? (11 posts)

Started 2 years, 8 months ago by: 21cdb

  • Profile picture of 21cdb 21cdb said 2 years, 8 months ago:

    I found the default size of the activity-avatar image is created in buddypress/bp-activity/bp-activity-templatetags.php.

    On line 238 is a funtion which determines the default image size of 20px x 20px.

    function bp_get_activity_avatar( $args = '' ) {
    		global $bp, $activities_template;
    
    		$defaults = array(
    			'type' => 'thumb',
    			'width' => 20,
    			'height' => 20,
    			'class' => 'avatar',
    			'alt' => __( 'Avatar', 'buddypress' )
    		);

    Is there an easy way to change these values without touching the bp core files? Can i use some hook or filter in bp-custom.php?

  • Profile picture of Tore Tore said 2 years, 7 months ago:

    I’d like to know this too.

    The only thing I’ve learnt is that you can create a bp-custom.php and place it in /wp-content/.

  • Profile picture of Tore Tore said 2 years, 7 months ago:

    http://buddypress.org/forums/topic/how-do-i-get-the-big-avatar-from-the-2-we-have#post-1146

    There’s an answer.

  • Profile picture of Tore Tore said 2 years, 7 months ago:

    I wanted to edit the forums avatar and could edit this:

    ‘<?php bp_the_topic_last_poster_avatar( ‘type=thumb&width=50&height=50′ ) ?>’

    You can find it in the theme /directories/forums/forums-loop.php.

  • Profile picture of 21cdb 21cdb said 2 years, 7 months ago:

    Hey Tore thanks for the hints, however i want to change the size of the activity avatar WITHOUT touching the bp core files.

    I have still no answer if it’s possible to do so by adding some lines of code to bp-custom.php, so if u know a method which isn’t altering the core files i would appreciate ur solution!

  • Profile picture of Tore Tore said 2 years, 7 months ago:

    Hi!

    In the example above I’m altering the forum poster avatar and am changing the size with with and height. So it works without editing core. Try if you can get the same effect with the function you are using.

    This is not a question of editing bp-core but the specific theme file. I was for example editing:

    theme_name/directories/forums/forums-loop.php.

    You’ll have to edit some theme file at least.

  • Profile picture of 21cdb 21cdb said 2 years, 7 months ago:

    But i’m trying to alter the activity-stream widget that comes with buddypress. The “template” file is located at buddypress/bp-activity/bp-activity-templatetags.php which is in the core directory.

    I could copy the plugin code and hard code it in my home.php but then i would have to track the edits Andy and the other developer are doing to the activity stream plugin.

    I would need a filter or hook to change the activity-stream widget avatar size.

  • Profile picture of Luciano Passuello Luciano Passuello said 1 year, 7 months ago:

    Hey @21cdb, did you have any luck with this issue of resizing avatars? I’m also looking for a solution to the same issue.

    Thanks!

  • Profile picture of ankurm ankurm said 7 months, 4 weeks ago:

    @21cdb and @lucianop were u guys able to resize the avatars?

  • Profile picture of @mercime @mercime said 7 months, 4 weeks ago:

    Two kinds of avatars in activity stream can be adjusted very simply via CSS

    1) For the large avatars – adjust image width and height, then add this to the bottom of your stylesheet

    ul.item-list li img.avatar {
        height: 100px;
        width: 100px;
    }

    2) For small avatars with the minor updates, adjust avatar image to preferred height and width then add this at the bottom of stylesheet

    .activity-list li.mini .activity-avatar img.avatar,
    .activity-list li.mini .activity-avatar img.FB_profile_pic {
        height: 100px;
        width: 100px;
    }
  • Profile picture of otreva otreva said 5 months, 2 weeks ago:

    @mercime

    For #1 above, that works, however that just resizes a 35 x 35 image via CSS to 100×100 making it look very pixelated and blurry.

    Here is an example for the BP Members Widget on how to change the sizing without the image being blurry:

    http://www.otreva.com/blog/buddypress-how-to-change-avatar-size-larger-or-smaller/