php图片加中文水印实现代码
php中要给中文加水印需要作一些简单的处理,一就是要把字符转换成gbk,还有就是要加载中文字体哦,有了这两个条件在图片加中文水印就简单了。
例1
代码如下 | 复制代码 |
Header("Content-type: image/png"); /*通知浏览器,要输出图像*/ $fontfile = "simkai.ttf"; /* $fontfile 字体的路径,视操作系统而定,可以是 simhei.ttf(黑体) , SIMKAI.TTF(楷体) , SIMFANG.TTF(仿宋) ,SIMSUN.TTC(宋体&新宋体) 等 GD 支持的中文字体*/ |
例2
代码如下 | 复制代码 |
// **************************************** // $text=iconv("gb2312","UTF-8",$text); //ImageTTFText(int im, int size, int angle, int x, int y, int col, string fontfile, string text): if ($new_img==""): ImageDestroy($im); //结束图形,释放内存空间 |
例3
代码如下 | 复制代码 |
/* //读取水印文件 switch($water_info[2])//取得水印图片的格式 //读取背景图片 switch($ground_info[2])//取得背景图片的格式 //水印位置 //设定图像的混色模式 if($isWaterImage)//图片水印 //生成水印后的图片 //释放内存 echo $num; if(isset($_FILES) && !emptyempty($_FILES['userfile']) && $_FILES['userfile']['size']>0) //文字水印 //图片水印 echo “ ?> |

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 English version
Recommended: Win version, supports code prompts!

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
