1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > php技术实现加载字体并保存成图片【PHP】

php技术实现加载字体并保存成图片【PHP】

时间:2023-03-21 14:12:26

相关推荐

php技术实现加载字体并保存成图片【PHP】

后端开发|php教程

php加载字体,php生成图片并保存,

后端开发-php教程

下面通过一段代码给大家详解介绍下php技术实现加载字体并保存成图片。

校庆网站源码,vscode对应标签,不知道ubuntu的分区怎么办,Tomcat存日志,sqlite 怎么拆分源码,jquery导出插件下载,前端大型项目框架选型,网络爬虫学什么好,php 转 ascii,天下seo博客,网站路径图,网页表格,易企秀的模板如何复制lzw

// Set the content-type header("Content-type: image/png"); // Create the image $im = imagecreatetruecolor(400, 100); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 100, $white); // The text to draw $text = 字典网; // Replace path by your own font path $font = fontName.ttf; // Add some shadow to the text //imagettftext($im, 60, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 60, 0, 0, 70, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im);

php团购网源码,ubuntu 怎么剑目录,系统启动tomcat服务,毛刷爬虫diy,php检测log日志,鹤壁什么是seo关键词优化营销lzw

如果想保存图可以用下面代码

固定资产管理系统源码,vscode教程pdf,怎么在微软商店下载ubuntu,tomcat进程概念,sqlite 如何参看关闭,jquery插件表单验证码,web前端 框架是什么,爬虫怎么出来的,php 难吗,seo竞价优化seo顾问,自由策划网站完整版源代码,网页全屏模式 js,手机网页制作模板,js实现自定义页面布局,dc文件管理系统v7.0.0.0 免费版,28程序源码lzw

ob_start(); imagejpeg($im); $img = ob_get_contents(); ob_end_clean(); $size = strlen($img); $fp2=@fopen( st.jpg, "a"); fwrite($fp2,$img); fclose($fp2);

以上代码就可以完成加载字体并保存成图片,希望大家会喜欢

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。