I want to remove the white background of any image uploaded on the site working on PHP platform. The uploading function is done but messed up with this functionality.
Since you only need single-color transparency, the easiest way is to define white with imagecolortransparent(). Something like this (untested code):
$img = imagecreatefromstring($your_image); //or whatever loading function you need
$white = imagecolorallocate($img, 255, 255, 255);
imagecolortransparent($img, $white);
imagepng($img, $output_file_name);