惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - Don

在Chrome中调试Android微信浏览器中的网页,不出现供选择页面的怎么办?(chrome://inspect/#devices) 使用Crontab集合sh脚本自动删除过期的Confluence Docker容器中的备份文件 解决命令行提示“cannot create temp file for here-document: No space left on device”但磁盘使用率并未满的问题 SSH登录后提示LC_ALL: cannot change locale (en_US.UTF8) 的解决办法 解决git操作一直要求输入用户名和密码的问题 CentOS如何增加虚拟内存 RabbitMQ集群脑裂故障处理 zookeeper日志定时清理 Alibaba Centos ECS 安全更新记录 AWS EC2配置CloudWatch 记录AWS Linux2 的yum安全更新步骤 记录Docker系统盘空间占用过大的解决方法 AWS EC2 EBS数据盘挂载与相关日常维护操作 AWS Amazon Linux2 安装Docker和Docker Compose [转]提升 Docker Desktop For macOS 磁盘使用率 AndroidGetAPKInfo --- 检查包名(packageName)、版本(versionName\versionCode)、应用签名(Signature)等信息 - Don OpenSSL命令—pkcs12 Linux下User与Group的常用操作命令解析 Docker搭建openvpn - Don
Docker PHP中安装gd扩展并生成图形验证码
Don · 2023-11-15 · via 博客园 - Don

在容器中执行:

apt install libjpeg62-turbo-dev libfreetype6-dev -y

docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg

docker-php-ext-install gd

可运行:php --ri gd 查看安装结果,重启docker容器。

图形验证码示例代码:

<?php
session_start();
function random($len) {
    $srcstr = "123456789ABCDEFGHJKLNPQRSTUVXYZ";
    $strs = "";
    for ($i = 0; $i < $len; $i++) {
        $strs .= $srcstr[mt_rand(0,30)];
    }
    return $strs;
}
 
//随机生成的字符串
$str = random(5); 
 
//验证码图片的宽度
$width  = 80;      
 
//验证码图片的高度
$height = 40;     
 
//声明需要创建的图层的图片格式
@ header("Content-Type:image/png");
 
//创建一个图层
$im = imagecreate($width, $height);
 
//背景色
$back = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
 
//模糊点颜色
$pix  = imagecolorallocate($im, 100, 207, 95);
 
//字体色
$color = imagecolorallocate($im, 100, 207, 2);

//边框颜色
$col = imagecolorallocate($im, 100, 164, 26);

//字体
putenv('GDFONTPATH=' . realpath('.'));//解决linux下GD库版本低于2.0.18不能显示的问题
$font = 'arial.ttf';
 
//绘模糊作用的点
mt_srand();
for ($i = 0; $i < 800; $i++) {
    imagesetpixel($im, mt_rand(0, $width), mt_rand(0, $height), $pix);
}
 
//输出字符
imagettftext($im, 16, 0, 5, 28, $color, $font, $str);

//输出矩形
imagerectangle($im, 0, 0, $width -1, $height -1, $col);
 
//输出图片
imagepng($im);
 
imagedestroy($im);
 
$str = md5(strtolower($str));
 
//选择 Session
$_SESSION["verification"] = $str;
?>