\Image

图像操作类库

Summary

Methods
Properties
Constants
getImageInfo()
water()
showImg()
thumb()
thumb2()
buildString()
buildImageVerify()
GBVerify()
showASCIIImg()
UPCA()
output()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getImageInfo()

getImageInfo(  $img) : mixed

取得图像信息

Parameters

$img

Returns

mixed

water()

water(string  $source, string  $water,   $savename = null, string  $alpha = 80) : void

为图片添加水印

Parameters

string $source

原文件名

string $water

水印图片

$savename
string $alpha

水印的透明度

showImg()

showImg(  $imgFile,   $text = '',   $x = '10',   $y = '10',   $alpha = '50') 

Parameters

$imgFile
$text
$x
$y
$alpha

thumb()

thumb(string  $image, string  $thumbname, string  $type = '', string  $maxWidth = 200, string  $maxHeight = 50, boolean  $interlace = true) : void

生成缩略图

Parameters

string $image

原图

string $thumbname

缩略图文件名

string $type

图像格式

string $maxWidth

宽度

string $maxHeight

高度

boolean $interlace

启用隔行扫描

thumb2()

thumb2(string  $image, string  $thumbname, string  $type = '', string  $maxWidth = 200, string  $maxHeight = 50, boolean  $interlace = true) : void

生成特定尺寸缩略图 解决原版缩略图不能满足特定尺寸的问题 PS:会裁掉图片不符合缩略图比例的部分

Parameters

string $image

原图

string $thumbname

缩略图文件名

string $type

图像格式

string $maxWidth

宽度

string $maxHeight

高度

boolean $interlace

启用隔行扫描

buildString()

buildString(string  $string,   $rgb = array(),   $filename = '', string  $type = 'png', integer  $disturb = 1, boolean  $border = true) : string

根据给定的字符串生成图像

Parameters

string $string

字符串

$rgb
$filename
string $type

图像格式 默认PNG

integer $disturb

是否干扰 1 点干扰 2 线干扰 3 复合干扰 0 无干扰

boolean $border

是否加边框 array(color)

Returns

string

buildImageVerify()

buildImageVerify(string  $length = 4, string  $mode = 1, string  $type = 'png', string  $width = 48, string  $height = 22,   $verifyName = 'verify') : string

生成图像验证码

Parameters

string $length

位数

string $mode

类型

string $type

图像格式

string $width

宽度

string $height

高度

$verifyName

Returns

string

GBVerify()

GBVerify(  $length = 4,   $type = 'png',   $width = 180,   $height = 50,   $fontface = 'simhei.ttf',   $verifyName = 'verify') 

Parameters

$length
$type
$width
$height
$fontface
$verifyName

showASCIIImg()

showASCIIImg(string  $image,   $string = '', string  $type = '') : string

把图像转换成字符显示

Parameters

string $image

要显示的图像

$string
string $type

图像类型,默认自动获取

Returns

string

UPCA()

UPCA(  $code, string  $type = 'png', string  $lw = 2, string  $hi = 100) : string

生成UPC-A条形码

Parameters

$code
string $type

图像格式

string $lw

单元宽度

string $hi

条码高度

Returns

string

output()

output(  $im,   $type = 'png',   $filename = '') 

Parameters

$im
$type
$filename