Skip to content

Commit e23c299

Browse files
Bigskgitee-org
authored andcommitted
修复了无法在非Windows内核操作系统中生成图片的bug
1 parent d4d4f0e commit e23c299

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

api.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@
6868
$background = imagecolorallocatealpha($canvas, 0, 0, 0, 127);//设置背景色
6969
imagefill($canvas, 0, 0, $background);//填充透明色
7070
imagecolortransparent($canvas, $background);//设置背景色
71-
$dir = dirname(__FILE__).'\\';//取得运行目录
72-
$text_fonts = $dir.'fnt.ttf';//设置字体
71+
$text_fonts = 'fnt.ttf';//设置字体
7372
$color = imagecolorallocate($canvas, 255, 255, 255);//设置文字颜色
7473
$text_size = 7;//设置文字大小
75-
$logo_url = $dir.'img.png';//设置源图片目录
74+
$logo_url = 'img.png';//设置源图片目录
7675
$logo = @file_get_contents($logo_url);//读取源文件
7776
$logo_img = imagecreatefromstring($logo);//解析为图片
7877
imagecopyresampled($canvas, $logo_img, 0, 0, 0, 0, 465, 92, imagesx($logo_img), imagesy($logo_img));//覆盖图层

0 commit comments

Comments
 (0)