boaPHP开发手册v5.5

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

open()

↑
说明
打开图像
参数 必须 默认值 类型 说明
$img Y string 图片绝对路径或二进制字符串
$type 0 int 打开类型,0=文件路径 1=二进制串

watermark()

↑
说明
添加水印
参数 必须 默认值 类型 说明
$type Y int 水印类型

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 同image类text()

save()

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

output()

↑
说明
输出图像
参数 必须 默认值 类型 说明
$type Y string 输出类型,如:png, jpeg, gif, webp, bmp等

clear()

↑
说明
销毁图像