Home > Article > Backend Development > PHP generates certificate of merit
ob_clean(); $realname = "姓名:最闲的码农"; $schoolname = "社区:Laravel"; $image = imagecreatefrompng('1562926506930.png'); //书模版图片文件的路径 必须是png格式的文件 $red = imagecolorallocate($image,00,00,00); // 字体颜色 // imageTTFText("Image", "Font Size", "Rotate Text", "Left Position","Top Position", "Font Color", "Font Name", "Text To Print"); //根据文本填写的位置不同 //"Left Position 和 Top Position 可以使用 getimagesize进行配合计算文字x和y轴坐标 imageTTFText($image, 50, 0, 628, 615, $red, 'simheittf.ttf',$realname); imageTTFText($image, 50, 0, 628, 714, $red, 'simheittf.ttf', $schoolname); header('Content-type: image/png;'); ImagePng($image); imagedestroy($image); $filename = 'certificate_aadarsh.png'; ImagePng($image, $filename); imagedestroy($image);
WechatIMG3.jpeg
Related recommendations: "PHP Tutorial"
The above is the detailed content of PHP generates certificate of merit. For more information, please follow other related articles on the PHP Chinese website!