关于imagettftext乱码的问题
imagettftext函数在windows下中文显示正常,在linux下中文就出现了乱码。。。
核心代码如下:
<code>//此处省略N行。。。 $image = imagecreatetruecolor($width, $height); $color = imagecolorallocate($image, $red, $green, $blue); imagefill($image, 0, 0, $color); $tcolor = imagecolorallocate($image, $tred, $tgreen, $tblue); //imagestring ($image, $fontfile, 20 , 20 , "Hello world!" , $tcolor); //echo floor(($height - $fontinfo['height']) / 2);die; imagettftext($image, $tsize, 0, ($width - $fontinfo['width']) / 2, $height / 2, $tcolor, $fontfile, $text); //此处省略N行。。。</code>
转码什么的都试过了,不行!也觉得不是编码的问题。。。
linux下也已经安装了msyh.ttf字体。。。
windows下显示:
linux下显示:
还望各位兄弟姐妹看看,小弟先谢过了!
回复内容:
imagettftext函数在windows下中文显示正常,在linux下中文就出现了乱码。。。
核心代码如下:
<code>//此处省略N行。。。 $image = imagecreatetruecolor($width, $height); $color = imagecolorallocate($image, $red, $green, $blue); imagefill($image, 0, 0, $color); $tcolor = imagecolorallocate($image, $tred, $tgreen, $tblue); //imagestring ($image, $fontfile, 20 , 20 , "Hello world!" , $tcolor); //echo floor(($height - $fontinfo['height']) / 2);die; imagettftext($image, $tsize, 0, ($width - $fontinfo['width']) / 2, $height / 2, $tcolor, $fontfile, $text); //此处省略N行。。。</code>
转码什么的都试过了,不行!也觉得不是编码的问题。。。
linux下也已经安装了msyh.ttf字体。。。
windows下显示:
linux下显示:
还望各位兄弟姐妹看看,小弟先谢过了!
%e6%88%91
是urlencode('我')
的结果,是不是通过URL进行参数传递没有解码的问题。
我很奇怪windows上是白色的,怎么Linux下就黄了。。
图片水印出现乱码,一般是两个问题。
文本编码是否统一为utf8
GD库是否启用JIS-mapped Japanese Font Support
编码不统一,那就统一一下,启用JIS-mapped Japanese Font Support了,就关闭即可。
什么?你说JIS-mapped Japanese Font Support怎么关闭?
我的方法是重新编译php-gd拓展。
确认过了
文件编码是一致的;
编译参数没有加 --enable-gd-jis-conv的;
windows下测试正常就直接上传到linux服务器了。。。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

PHP 8.4 带来了多项新功能、安全性改进和性能改进,同时弃用和删除了大量功能。 本指南介绍了如何在 Ubuntu、Debian 或其衍生版本上安装 PHP 8.4 或升级到 PHP 8.4

CakePHP 是 PHP 的开源框架。它的目的是使应用程序的开发、部署和维护变得更加容易。 CakePHP 基于类似 MVC 的架构,功能强大且易于掌握。模型、视图和控制器 gu
