当前位置:网站首页>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边栏推荐
- [combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
- ArrayList analysis 3: delete elements
- Simple configuration of postfix server
- [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
- [RT thread] NXP rt10xx device driver framework -- Audio construction and use
- Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
- SQL injection database operation foundation
- Enterprise custom form engine solution (XI) -- form rule engine 1
- 远程办公工具分享|社区征文
- The difference between i++ and ++i: tell their differences easily
猜你喜欢

Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you

1146_ SiCp learning notes_ exponentiation
![[UE4] brush Arctic pack high quality Arctic terrain pack](/img/e7/bc86bd8450b0b2bdec8980a2aa1a10.jpg)
[UE4] brush Arctic pack high quality Arctic terrain pack

Wechat applet for the first time

1164 Good in C

Design e-commerce spike

QT learning diary 9 - dialog box

Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method

Kubernetes resource object introduction and common commands (III)
![[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](/img/f1/c96c4a6d34e1ae971f492f4aed5a93.jpg)
[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
随机推荐
What is the difference between cloud server and cloud virtual machine
基于主机的入侵系统IDS
Dagong 21 autumn "power plant electrical part" online operation 1 [standard answer] power plant electrical part
University of Electronic Science and technology, accounting computerization, spring 20 final exam [standard answer]
IntelliJ 2021.3 short command line when running applications
Rsync remote synchronization
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
Notes on problems -- watching videos on edge will make the screen green
Kotlin学习快速入门(7)——扩展的妙用
How to read the source code [debug and observe the source code]
[RT thread] NXP rt10xx device driver framework -- Audio construction and use
Apache服务挂起Asynchronous AcceptEx failed.
SWM32系列教程4-端口映射及串口应用
Y is always discrete and can't understand, how to solve it? Answer: read it several times
简单配置PostFix服务器
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos
HP 阵列卡排障一例
1146_ SiCp learning notes_ exponentiation
The difference between get and post
Vs2013 has blocked the installer, and ie10 needs to be installed