博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PHP背景水印图片生成代码
阅读量:4108 次
发布时间:2019-05-25

本文共 1113 字,大约阅读时间需要 3 分钟。

转自
http://www.75271.com/1150.html

php背景图片生成代码

/** 
*@author:yangtao
*@date:2016-08-12
*@content: 背景水印
*/
public function getbgwatermark(){
 
$imgWidth = 150;
$imgHeight = 150;
$img = imagecreatetruecolor($imgWidth, $imgHeight);
$bgcolor = imagecolorallocate($img,255,255,255);
imagefill($img, 0, 0, $bgcolor);
 
$text = imagecreatetruecolor($imgWidth, $imgHeight);
imagefill($text, 0, 0, $bgcolor);
$font_size = 10;
$font_name = VENDOR_PATH."topthink/think-captcha/assets/ttfs/1.ttf";
$ucode = $this->getUserinfo('userCode');
if($ucode=="") $ucode = "测试文字";
$font_color = imagecolorallocate($img, mt_rand(100,200), mt_rand(100,200), mt_rand(100,200));
imagettftext($text, $font_size, 50, 10,90, $font_color, $font_name, $ucode);
 
imagecopymerge($img,$text,0,0,0,0,$imgWidth,$imgHeight,20);
 
header('content-type:image/png');
imagepng($img);
imagedestroy($img);
}

转载地址:http://qmpsi.baihongyu.com/

你可能感兴趣的文章
mysql update与group by
查看>>
nginx反代 499 502 bad gateway 和timeout
查看>>
linux虚拟机安装tar.gz版jdk步骤详解
查看>>
python猜拳游戏
查看>>
python实现100以内自然数之和,偶数之和
查看>>
python数字逆序输出及多个print输出在同一行
查看>>
ESP8266 WIFI数传 Pixhaw折腾笔记
查看>>
苏宁产品经理面经
查看>>
百度产品经理群面
查看>>
去哪儿一面+平安科技二面+hr面+贝贝一面+二面产品面经
查看>>
element ui 弹窗在IE11中关闭时闪现问题修复
查看>>
vue 遍历对象并动态绑定在下拉列表中
查看>>
Vue动态生成el-checkbox点击无法选中的解决方法
查看>>
python __future__
查看>>
MySQL Tricks1
查看>>
python 变量作用域问题(经典坑)
查看>>
pytorch
查看>>
pytorch(二)
查看>>
pytorch(三)
查看>>
pytorch(四)
查看>>