当前位置:网站首页>thinkphp 添加图片文字水印生成带二维码的推广海报
thinkphp 添加图片文字水印生成带二维码的推广海报
2022-04-23 11:36:00 【IT工作者】
<?php
$image = new \Think\Image();
$bgm='./Public/haibao.png'; //背景图
$poster="./Public/poster/$gid.jpg"; //商品水印图位置
$img=explode('/',$list['image']);
$goods="/mnt/data/wwwroot/bzl/Uploads/{$img['4']}/{$img['5']}";
$baocun="./Public/thumbnail/$gid.jpg";//商品缩略图位置
$image->open($goods)->thumb(460, 460,\Think\Image::IMAGE_THUMB_CENTER)->save($baocun);//缩略图
//$image->open($bgm)->water($thumb,\Think\Image::IMAGE_WATER_NORTH,100)->save($poster);
$image->open($bgm)->water($baocun,\Think\Image::IMAGE_WATER_NORTH,100)->save($poster);//加背景水印
$qrcode=$this->shopqrcode($_GET['uid']);
$qr=explode('/',$qrcode);
//$qr=strripos($qrcode,'/');
$end = end($qr);
//$qrcodeimg="/mnt/data/wwwroot/bzl/Qrcode/watermark/$end";
//$qrcodeimg="/mnt/data/wwwroot/bzl/Qrcode/$uid.png"; //二维码
$qrcodeimg="/mnt/data/wwwroot/bzl/Qrcode/$end";
//$qrcodeimg="https://".$_SERVER[SERVER_NAME]."/Qrcode/$id".".png";//返回二维码
$sulvtu="./Public/thumbnail/code-"."$gid.jpg";//商品缩略图位置
$image->open($qrcodeimg)->thumb(200, 200,\Think\Image::IMAGE_THUMB_CENTER)->save($sulvtu); //缩略图
$code="./Public/code/$gid.png"; //二维码水印
$wz=array(130,535);//二维码水印位置
$image->open($poster)->water($sulvtu,$wz,100)->save($code);//二维码添加到背景图水印
$fonts="./msyh.ttf";
$img="./Public/img/$type.$gid.jpg";//最终的海报
$prceiwz=array(30,485);//价格水印位置
$titlewz=array(20,510);//价格水印位置
$res=$image->open($code)->text($list['title'],$fonts,12,'#000000',$titlewz,0,0)
->text($list['price'],$fonts,14,'#FF0000',$prceiwz,0,0)->save($img);
?>
版权声明
本文为[IT工作者]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1986086
边栏推荐
- 讯飞2021年营收183亿:同比增41% 净利为15.56亿
- On the integration of steam education in early childhood education
- Résumé de la relation entre GPU, cuda et cudnn
- 5个免费音频素材网站,建议收藏
- On lambda powertools typescript
- Simple construction of rebbitmq
- Analyze the rules for the use of robots with good performance
- 年度最尴尬的社死瞬间,是Siri给的
- Practical data Lake iceberg lesson 30 MySQL - > iceberg, time zone problems of different clients
- 2022爱分析· 工业互联网厂商全景报告
猜你喜欢

SOFA Weekly | 年度优秀 Committer 、本周 Contributor、本周 QA

Overall plan management mode in maker Education

云呐|固定资产盘点中,支持多种盘点方式(资产清查盘点)

Redis optimization series (II) redis master-slave principle and master-slave common configuration
![[Web 每日一练] 八色拼图(float)](/img/59/474080f6377b3684aa4fb2a39e1d81.png)
[Web 每日一练] 八色拼图(float)

RebbitMQ的初步了解

On the integration of steam education in early childhood education

Laravel增加自定义助手函数

MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题

探究机器人教育的器材与教学
随机推荐
获取钉钉考勤机打卡记录
解读机器人创造出来的艺术
Study notes of C [8] SQL [1]
Golang Pen & interview 01
nacos基础(6):nacos配置管理模型
Maker education for primary and middle school students to learn in happiness
nacos基础(8):登录管理
卷积层和池化层总结
Summary of QT semaphore unresolved errors
Laravel adds custom helper functions
Tensorflow使用keras创建神经网络的方法
C#的学习笔记【八】SQL【一】
Tclerror: no display name and no $display environment variable
Docker MySQL master-slave backup
Usage record of map < qstring, bool >
Learn go language 0x06: Fibonacci closure exercise code in go language journey
Who said you should know PS? This open-source artifact can also be pulled in batch, and the effect is outstanding!
Nacos Basics (5): getting started with Nacos configuration
Tensorflow common functions
Yunna | how to manage the company's fixed assets and how to manage fixed assets