Skip to:
Content
Pages
Categories
Search
Top
Bottom

avatar background color if image too small


  • enlightenmental1
    Participant

    @enlightenmental1

    If I upload an image as an avatar that is “too small” the extra background space is black…

    I need this to be white

    any pointers?

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

  • Aron Jay
    Participant

    @aronjay

    CSS?


    Marco72
    Participant

    @marco72

    I have the same question. If I upload a .png with transparent background it turns to black bg.


    nicolagreco
    Participant

    @nicolagreco

    It’s related to PHP-gd not css..

    Imagecolorallocatealpha() for the transparent background colour. Idk offhand if you can get a plugin to do this or if you have to hack the core.


    enlightenmental1
    Participant

    @enlightenmental1

    thanks for the input,

    looks like this will determine the background color…. (non transparent)

    ImageColorAllocate ($handle, 255, 0, 0);

    taken from:

    http://php.about.com/od/advancedphp/ss/gd_library_2.htm

    is this code something that exists in the bp-core avatars file?

    im not sure where i would add this…

    i\’ve looked in:

    bp-core-avatars.php

    wp-admin/includes/file.php

    wp-admin/imcludes/image.php

    i’m fine with hacking the core…

    image_resize() in /wp-includes/media.php ?


    Alex999
    Participant

    @alex999

    Has anybody the solution for the problem?


    Jeff Sayre
    Participant

    @jeffsayre

    @alex999

    This is not an bug with BuddyPress. This is not a bug with anything else either.

    There is a minimum image file size (50px by 50px) that must be uploaded for avatars. If the file is smaller in width and/or height than the minimum required, the extra pixels will be black.

    You could change the minimum file dimensions, but it seems to me that the set minimum is more than sufficient.


    Alex999
    Participant

    @alex999

    What I suggest is “height: auto and width: for example 50px as it is. Is that possible?

    I tried to change the code as follows:

    /* Define settings for avatars. [TODO] This will eventually end up as admin configurable settings */

    define( ‘CORE_AVATAR_V1_W’, apply_filters( ‘bp_core_avatar_v1_w’, 90 ) );

    define( ‘CORE_AVATAR_V1_H’, apply_filters( ‘bp_core_avatar_v1_h’, auto ) );

    define( ‘CORE_AVATAR_V2_W’, apply_filters( ‘bp_core_avatar_v2_w’, 180 ) );

    define( ‘CORE_AVATAR_V2_H’, apply_filters( ‘bp_core_avatar_v2_h’, auto ) );

    define( ‘CORE_CROPPING_CANVAS_MAX’, apply_filters( ‘bp_core_avatar_cropping_canvas_max’, 450 ) );

    define( ‘CORE_MAX_FILE_SIZE’, get_site_option(‘fileupload_maxk’) * 1024 );

    Unfortunately it gives me an error message. I have no idea why….

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘avatar background color if image too small’ is closed to new replies.
Skip to toolbar