标签:turn ret return back 效果 ext images 字体 alt
//线下证书背面合成 public function CreateOfflineCourseCertBack($type=1) { //盖章图片 $mix_img=ROOT_PATH . ‘public/uploads/certsimg/offline_cert_back_mix.png‘; //背景图片 //使用课程 $back_1 = ROOT_PATH . ‘public/uploads/certsimg/offline_cert_back_1.png‘; // $back_2 = ROOT_PATH . ‘public/uploads/certsimg/offline_cert_back_2.png‘; $type==1 && $path_1=$back_1; $type==2 && $path_1=$back_2; //创建图片对象 $image_1 = imagecreatefrompng($path_1); $image_2 = imagecreatefrompng($mix_img); //合成图片 imagecopy($image_1, $image_2, 471, 210, 0, 0, imagesx($image_2), imagesy($image_2)); //这是要插入到图片的文字 $orgcenter = ‘123培训中心‘; $orgaddress = ‘123科范德萨‘; $teacher = ‘李天一 202006061234‘; //文件名 $filename="temp"; //设置文字颜色 $black = imagecolorallocate($image_1, 0, 0, 0); //写的文字用到的字体 $font = ROOT_PATH . ‘public/uploads/certsimg/simhei.ttf‘; //在图片里插入文字$black imagettftext($image_1, 20, 0, 161, 143, $black,$font, $orgcenter); imagettftext($image_1, 20, 0, 161, 193, $black,$font, $orgaddress); imagettftext($image_1, 20, 0, 161, 241, $black, $font, $teacher); //这是合成后的图片保存的路径 $upload_dir = "public/uploads/certsimg/"; imagepng($image_1, ROOT_PATH . $upload_dir . $filename . ‘.png‘); $finalurl=‘uploads/certsimg/‘.$filename . ‘.png‘; return $finalurl; } }
效果如图
关键是那个章 要透明
标签:turn ret return back 效果 ext images 字体 alt
原文地址:https://www.cnblogs.com/baker95935/p/13053571.html