CrossPHP

Image
in package
implements IFilter

图片过滤

Tags
author

wonli wonli@live.com

Interfaces, Classes and Traits

IFilter
Interface IFilter

Table of Contents

$absoluteHeight  : bool
图片高度使用绝对值
$absoluteWidth  : bool
图片宽度使用绝对值
$height  : int
最小高度
$imageType  : array<string|int, mixed>
允许上传的文件类型
$minOrMax  : string
限定最大还是最小高宽 默认最小高宽
$width  : int
最小宽度
fileType()  : $this
设置允许上传的图片类型
filter()  : bool
上传文件过滤
setWidthHeight()  : Image
设置图片高宽
useAbsoluteHeight()  : $this
高度相等通过验证
useAbsoluteWidth()  : $this
宽度相等通过验证

Properties

$absoluteHeight

图片高度使用绝对值

protected bool $absoluteHeight = false

$absoluteWidth

图片宽度使用绝对值

protected bool $absoluteWidth = false

$height

最小高度

protected int $height

$imageType

允许上传的文件类型

protected array<string|int, mixed> $imageType = ['jpg', 'png', 'jpeg', 'gif']

$minOrMax

限定最大还是最小高宽 默认最小高宽

protected string $minOrMax = 'min'

$width

最小宽度

protected int $width

Methods

fileType()

设置允许上传的图片类型

public fileType(string $fileType) : $this
Parameters
$fileType : string
Return values
$this

filter()

上传文件过滤

public filter(mixed $file[, string &$error = '' ]) : bool
Parameters
$file : mixed

文件信息

$error : string = ''
Return values
bool

成功返回true

setWidthHeight()

设置图片高宽

public setWidthHeight(int $width, int $height[, string $minOrMax = 'min' ]) : Image
Parameters
$width : int
$height : int
$minOrMax : string = 'min'

限定最小还是最大宽度

Return values
Image

useAbsoluteHeight()

高度相等通过验证

public useAbsoluteHeight() : $this
Return values
$this

useAbsoluteWidth()

宽度相等通过验证

public useAbsoluteWidth() : $this
Return values
$this

Search results