boa框架开发手册v5.2

gd类
版本 1.0+
命名空间 boa\image\driver
文件 boa/image/driver/gd.php
说明 GD驱动类,继承driver类
目录
方法 说明
watermark() 添加水印
scale() 图像缩放
crop() 图像剪裁
rotate() 图像旋转
flatten() 背景填充
flip() 图像翻转
text() 图像上写文字
save() 保存图像
output() 输出图像
方法

watermark()

说明
添加水印

scale()

说明
图像缩放
参数 必须 默认值 类型 说明
$dst_w Y int 目标宽度,-1=自动
$dst_h -1 int 目标高度,-1=自动

crop()

说明
图像剪裁
参数 必须 默认值 类型 说明
$dst_w Y int 剪裁宽度
$dst_h Y int 剪裁高度
$src_x 0 int 剪裁起点X坐标
$src_y 0 int 剪裁起点Y坐标

rotate()

说明
图像旋转
参数 必须 默认值 类型 说明
$angle Y int 旋转角度
$bgcolor Y string 旋转后背景填充色

flatten()

说明
背景填充
参数 必须 默认值 类型 说明
$bgcolor Y string 背景填充色

flip()

说明
图像翻转
参数 必须 默认值 类型 说明
$mode Y int 翻转模式
  • -1=水平翻转
  • 1=垂直翻转
  • 0=同时翻转

text()

说明
图像上写文字
参数 必须 默认值 类型 说明
$text Y string 文字
$cfg Y array 同父类text()

save()

说明
保存图像
参数 必须 默认值 类型 说明
$to Y string 保存路径
$quality Y int 图像质量

output()

说明
输出图像
参数 必须 默认值 类型 说明
$type null string 输出类型,可选值:png, jpeg, gif