Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile image sizes


  • John
    Participant

    @jhob

    On a BP site that I have recently taken over management of the default profile image size has been set to 1920 x 1111 and the avatar size to 86 x 50.

    In a lot of places on the site images are shown at a size of around 346 x 200 making the avatar size too small and the full size way too big with lots of wasted bandwidth.

    Is it possible to set custom sizes in between these to use in an srcset for responsive images, as you could do with add_image_size()?

Viewing 9 replies - 1 through 9 (of 9 total)

  • Venutius
    Moderator

    @venutius

    Look for a file in wp-content/plugins/bp-custom.php this contains the code to set the avatar sizes.


    John
    Participant

    @jhob

    Those sizes are already set there:

    
    <?php
    
    // Resizes avatars
    define ( 'BP_AVATAR_THUMB_WIDTH', 86 );
    define ( 'BP_AVATAR_THUMB_HEIGHT', 50 );
    define ( 'BP_AVATAR_FULL_WIDTH', 1920 );
    define ( 'BP_AVATAR_FULL_HEIGHT', 1111 );
    define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 2000 );
    define ( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 );
    
    // Changes default avatar
    define ( 'BP_AVATAR_DEFAULT', esc_url( home_url( '/' ) ).'wp-content/themes/ihg2014/images/avatar.jpg' );
    define ( 'BP_AVATAR_DEFAULT_THUMB', esc_url( home_url( '/' ) ).'wp-content/themes/ihg2014/images/avatar_thumb.jpg' );
    
    //Removes automatic links in user profiles
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data',  9, 2 );
    

    I am wanting to create image sizes additional to these.

    Is there a way of doing that in bp-custom.php?


    Venutius
    Moderator

    @venutius

    BP only has a thumb avatar and a full size avatar, there’s no other avatar images it uses.


    John
    Participant

    @jhob

    With the sizes set as they are on the site that’s rather limiting.

    Is there any way around this?


    John
    Participant

    @jhob

    Also it seems that something has created an additional size (600 x 200 in our case, no idea why it has been created), see screenshot of an avatar image directory:

    Any explanation for that?


    Venutius
    Moderator

    @venutius

    That’s interesting, I’m not aware of how you would get BP to create and use a third avatar size, maybe you have a third party plugin/code that is creating that?


    John
    Participant

    @jhob

    It is possible that a 3rd party plugin is doing that – there’s certainly a lot on the site!

    Now if only I could work out which one and make proper use of it that would be great…


    Venutius
    Moderator

    @venutius

    I’ve got a plugin called BP Profile Shortcodes Extra that has a shortcode to display the value of an xprofile field, you could take a look at how I did that and use that as a basis for your code?


    Venutius
    Moderator

    @venutius

    whoops, wrong thread, please ignore my last comment.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar