一、png圖檔生成
public function entryOp() {
$img = 'http://newmall.yewugou.com/ylfapporderform/images/test.png';
list($width, $height) = @getimagesize($img);
$image = imagecreatefrompng($img);//建立圖檔模闆
imagesavealpha($image,true);//保留通道資訊
$thumb = imagecreatetruecolor($width,$height);//建立真彩圖
//設定字型開始
$black = imagecolorallocate($image, 98, 52, 11);//拾色器
$font_file = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'mobile'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.'msyh.ttf';
imagefttext($image, 25, 0, 980, 125, $black, $font_file, '2016年11月05日');
imagefttext($image, 25, 0, 980, 165, $black, $font_file, '2017年05月05日');
imagefttext($image, 25, 0, 630, 295, $black, $font_file, '夢兒');
imagefttext($image, 25, 0, 630, 390, $black, $font_file, '18005076960');
imagefttext($image, 25, 0, 630, 480, $black, $font_file, '18005076960');
imagefttext($image, 25, 0, 630, 570, $black, $font_file, '伐木累');
$color = imagecolorallocate($image, 255, 84, 31);
imagefttext($image, 40, 0, 530, 690, $color, $font_file, '動作');
//設定字型結束
imagealphablending($thumb,false);
imagesavealpha($thumb,true);
imagecopyresampled($thumb,$image,0,0,0,0,$width,$height,$width,$height);
header("content-type: image/png");
imagepng($thumb);
imagedestroy($image);
}