当前位置:网站首页>PHP processing - watermark images (text, etc.)
PHP processing - watermark images (text, etc.)
2022-07-03 17:31:00 【Add gold development】
<?php
// Specify the image path
//1. Open the image to be watermarked
$img_logf_src="https://img1.baidu.com/it/u=554809536,2732110137&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=560";
$image = imagecreatefromjpeg($img_logf_src);
// Get picture information
$info = getimagesize($img_logf_src);
$type = image_type_to_extension($info[2],false);// Get the image extension
//2. Draw an image on the canvas
$bai = imagecolorallocate($image, 255, 255, 255);
$bai2 = imagecolorallocate($image, 0, 0, 0);
// typeface
$fontfil=dirname(__FILE__).'/SimHei.ttf';// typeface Absolute path
//3. Set watermark text
$text = 'XXXXXXX project '."\n";
$city= ' Chengdu ';
$user_name= '【 Zhang San 】'."\n";
$today = date( "D M j G:i:s T Y ");// Time
$text_center=$user_name.$text.$city.$today;
$font_siz=(int)($info[0]/30);// font size 0= wide 1= high
$font_y=(int)($info[1]-($info[0]/10)-20);// coordinate y
$font_x=(int)(($info[0]/10)-($info[0]/10)+10);// coordinate X
imagettftext($image, $fon
边栏推荐
- WEB-UI自动化测试-最全元素定位方法
- 人生还在迷茫?也许这些订阅号里有你需要的答案!
- 一位普通程序员一天工作清单
- Play with fancy special effects. This AE super kit is for you
- 2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
- QT learning diary 9 - dialog box
- vs2013已阻止安装程序,需安装IE10
- How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
- c# . Net tool ecosystem
- Detailed explanation of common network attacks
猜你喜欢
[set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
STM32实现74HC595控制
vs2013已阻止安装程序,需安装IE10
Select 3 fcpx plug-ins. Come and see if you like them
Vs2013 has blocked the installer, and ie10 needs to be installed
SQL injection database operation foundation
Golang unit test, mock test and benchmark test
设计电商秒杀
Automata and automatic line of non-standard design
1146_ SiCp learning notes_ exponentiation
随机推荐
Vs code plug-in korofileheader
A day's work list of an ordinary programmer
Web-ui automated testing - the most complete element positioning method
SWM32系列教程4-端口映射及串口应用
Kubernetes resource object introduction and common commands (4)
Solution to long waiting time of SSH connection to remote host
Golang单元测试、Mock测试以及基准测试
Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
SVN完全备份svnadmin hotcopy
Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
How do large consumer enterprises make digital transformation?
Wechat applet for the first time
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
Leetcode 669 pruning binary search tree -- recursive method and iterative method
AcWing 3438. Number system conversion
Leetcode Valentine's Day Special - looking for a single dog
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
Where is the database account used when running SQL tasks in data warehouse tasks configured
SQL injection database operation foundation