$im = imagecreatefromjpeg($imagepath);
$white = imagecolorallocate($im, 255,255,255);
$black = imagecolorallocate($im, 0,0,0);
// Replace path by your own font path
$colorA=hexdec(substr($fontcolor,0,2));
$colorB=hexdec(substr($fontcolor,2,2));
$colorC=hexdec(substr($fontcolor,4,2));
$color = imagecolorallocate($im,$colorA,$colorB,$colorC);
imagettftext($im, $fontsize, 0, $x,$y,$color, $ttfpath, $text );
imagejpeg($im,$imagepath);
imagedestroy($im);其实发现,写在图片上文字颜色都不对,不知道为什么?