Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Instructions on how to change the black background of uploading png/gif image*

sahotataransahotataran Rare Visitor ✭✭
edited October 2011 in Questions
The image uploaded using Change my picture is always uploaded with a black background color if it is png or giff. i fixed it to change it to custom color by the changes as described below:
go to vanilla install directory -> library -> core ->
open file class.uploadimage.php
go down and there will be something like:
// Create a new image from the raw source
if (function_exists('imagecreatetruecolor')) {
$TargetImage = imagecreatetruecolor($Width, $Height); // Only exists if GD2 is installed
} else
$TargetImage = imagecreate($Width, $Height);


replace the above lines with

// Create a new image from the raw source
if (function_exists('imagecreatetruecolor')) {
$TargetImage = imagecreatetruecolor($Width, $Height); // Only exists if GD2 is installed
$bg = imagecolorallocate($TargetImage, 255, 255, 255);
imagefill($TargetImage, 0, 0, $bg);

imagecopy($TargetImage, $trans, 0, 0, 0, 0, $w, $h);
} else {
$TargetImage = imagecreate($Width, $Height);
$bg = imagecolorallocate($TargetImage, 255, 255, 255);
imagefill($TargetImage, 0, 0, $bg);
}


note that in place of 255,255,255 you can get a color code of which ever color you want in RGB and substitute it there.

Theme Charcha for great desktop and mobile experience! - drop me a message :)

Tagged:
Sign In or Register to comment.