//保證可以解決!!!?圖片路徑、字體路徑,等??自己?用你自己的?
?//不用去啥bom頭,和加?ob_clean();有的加了這句,也不一定管用
$dst_path?=?"des_big.jpg";
//創建圖片的實例
$dst?=?imagecreatefromstring(file_get_contents($dst_path));
//打上文字
$font?=?'../FONTS/MSYH.TTF';//字體路徑
$color?=?imagecolorallocate($dst,?0x00,?0x00,?0x00);//字體顏色
imagefttext($dst,?13,?0,?20,?20,?$color,?$font,?'快樂編程');
//輸出圖片
list($dst_w,?$dst_h,?$dst_type)?=?getimagesize($dst_path);
switch?($dst_type)?{
????case?1://GIF
????????header('Content-Type:?image/gif');
????????imagegif($dst);
????????break;
????case?2://JPG
????????header('Content-Type:?image/jpeg');
????????imagejpeg($dst);
????????break;
????case?3://PNG
????????header('Content-Type:?image/png');
????????imagepng($dst);
????????break;
????default:
????????break;
}
2017-09-15