I have the same question. If I upload a .png with transparent background it turns to black bg.
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.
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 ?
Has anybody the solution for the problem?
@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.
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….