Closed hetao29 closed 6 months ago
I can not reproduce this issue. Please make sure that you are using the latest version of the GD and/or Imagick library and a font that supports the corresponding characters.
$image = ImageManager::withDriver($driver)
->create(300, 300)
->fill('fff');
$image->text("中国", 150, 150, function ($font) {
$font->filename('ArialUnicodeMS.ttf');
$font->size(70);
$font->color('000');
$font->align('center');
$font->valign('middle');
});
PHP Version: 8.3.4 OS: MacOS Intervention Image Version: 3.6.2 Imagick 3.7.0 / ImageMagick 7.1.1-27 Q16-HDRI aarch64 GD 2.3.3
$fonts = "/fonts/msyh.ttf";
$mgr = Intervention\Image\ImageManager::imagick();
//$mgr = Intervention\Image\ImageManager::gd();
$img = $mgr->create(400,300);
$text="我是中国人";
$txt_color="rgba(121,143,85,1)";
$img->text($text,50,100,function (Intervention\Image\Typography\FontFactory $font) use ($fonts,$txt_color){
$font->file($fonts);
$font->size(30);
$font->color($txt_color);
$font->align('left');
$font->valign('bottom');
});
This image is build by imagick: This image is build by gd:
PHP Version 8.3.6 OS: System | Linux 5.15.0-105-generic #115-Ubuntu SMP Mon Apr 15 09:52:04 UTC 2024 x86_64 Configure Command: './configure' '--prefix=/data/php8' '--with-ldap' '--with-zlib' '--with-gettext' '--enable-intl' '--enable-exif' '--with-mysqli' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--with-curl' '--enable-ftp' '--enable-gd' '--with-freetype' '--with-jpeg' '--with-webp' '--enable-gd-jis-conv' '--with-imap' '--enable-mbstring' '--enable-pcntl' '--enable-mysqlnd' '--with-pdo-mysql' '--enable-sockets' '--with-zip' '--enable-bcmath' '--with-kerberos' '--with-imap-ssl' '--with-openssl' '--without-pdo-sqlite' '--without-sqlite3' '--enable-calendar' '--enable-shmop' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' |
---|
Php Info:
GD info:
Imageic Info:
Intervention Image Version: 3.6.2
Works as well. Maybe upgrading to a newer GD version helps.
Describe the bug gd output chinese string need to unicode imagic not need
Code Example
Expected behavior do not toUnicode when use the gd.