Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

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

sahotataransahotataran Developer, Bay Area - CA ✭✭✭
edited October 2011 in Vanilla 2.0 - 2.8
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.

There was an error rendering this rich post.

Tagged:
Sign In or Register to comment.