The background color goes black after I crop the image, even I add this to my code. Some experts please look at what wrong with my code.
$bg = imagecolorallocate($tci, 255, 255, 255); imagefill($tci, 0, 0, $bg);
[php] list($w_orig, $h_orig) = getimagesize($target);
$src_x = ($w_orig / 2) - ($w / 2);
$src_y = ($h_orig / 2) - ($h / 2);
$ext = strtolower($ext);
$img = “”;
if ($ext == “gif”){
$img = imagecreatefromgif($target);
} else if($ext ==“png”){
$img = imagecreatefrompng($target);
} else {
$img = imagecreatefromjpeg($target);
}
$tci = imagecreatetruecolor($w, $h);
$bg = imagecolorallocate($tci, 255, 255, 255);
imagefill($tci, 0, 0, $bg);
imagecopyresampled($tci, $img, 0, 0, $src_x, $src_y, $w, $h, $w, $h);
if ($ext == "gif"){
imagegif($tci, $newcopy);
} else if($ext =="png"){
imagepng($tci, $newcopy);
} else {
imagejpeg($tci, $newcopy, 84);
}
}[/php]
Thank you for reading it