Home > Backend Development > PHP Problem > What to do if php Chinese watermark is garbled

What to do if php Chinese watermark is garbled

藏色散人
Release: 2023-03-02 11:56:02
Original
2835 people have browsed it

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.

What to do if php Chinese watermark is garbled

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 ImageTTFTextEnough.

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template