Solution to garbled Chinese watermark in php: 1. Add the statement "utf-8"; 2. Use iconv to convert the text to be generated to "utf-8"; 3. Change the function to generate text to "ImageTTFText" function.
The problem of Chinese garbled characters when php generates text watermarks
In the past two days, I helped colleagues test the synthesis of pictures and text The result is that there is no problem with image synthesis, but when synthesizing text, I encountered a small problem. The Chinese text was always garbled. I thought at first that the declaration utf-8 was not added. After adding it, I found that it still didn't work. Then I used iconv to generate the text. Converting to utf-8 still doesn't work. After searching, I finally found that there is a problem with the function used to generate text. I used this imagestring() before. It seems that this function does not support Chinese, so I changed it to ImageTTFText
Enough.
For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of What to do if php Chinese watermark is garbled. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor
