Skip to content

Commit

Permalink
修复了无法在非Windows内核操作系统中生成图片的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bigsk authored and gitee-org committed Apr 14, 2020
1 parent d4d4f0e commit e23c299
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@
$background = imagecolorallocatealpha($canvas, 0, 0, 0, 127);//设置背景色
imagefill($canvas, 0, 0, $background);//填充透明色
imagecolortransparent($canvas, $background);//设置背景色
$dir = dirname(__FILE__).'\\';//取得运行目录
$text_fonts = $dir.'fnt.ttf';//设置字体
$text_fonts = 'fnt.ttf';//设置字体
$color = imagecolorallocate($canvas, 255, 255, 255);//设置文字颜色
$text_size = 7;//设置文字大小
$logo_url = $dir.'img.png';//设置源图片目录
$logo_url = 'img.png';//设置源图片目录
$logo = @file_get_contents($logo_url);//读取源文件
$logo_img = imagecreatefromstring($logo);//解析为图片
imagecopyresampled($canvas, $logo_img, 0, 0, 0, 0, 465, 92, imagesx($logo_img), imagesy($logo_img));//覆盖图层
Expand Down

0 comments on commit e23c299

Please sign in to comment.