您尚未登录。

楼主 #1 2018-05-25 14:18:47

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

使用 php gd 生成图片

参考: https://blog.csdn.net/qq_26245325/article/details/79918945

安装php gd库,并重启apache2:

sudo apt-get install php5-gd
sudo service apache2 restart

<?php
//需要开启gd库
header("Content-type: image/png");
$im = imagecreatetruecolor(512, 512)
or die("Cannot Initialize new GD image stream");
$white = imagecolorallocate($im, 255, 255, 255);
for ($y=0; $y<512; $y++) {
for ($x=0; $x<512; $x++) {
if (rand(0,1) === 1) {
imagesetpixel($im, $x, $y, $white);
}
}
}
imagepng($im);
imagedestroy($im);
?>




离线

楼主 #2 2018-05-25 14:19:58

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 使用 php gd 生成图片

QQ20180525141937.png





离线

#3 2020-09-09 08:20:43

湘楚浪子
会员
注册时间: 2019-12-22
已发帖子: 40
积分: 39.5

Re: 使用 php gd 生成图片

php生成二维码用的就是这个吧。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn