PHP Class CloudImageModel, thinksns

Exibir arquivo Open project: medz/thinksns-4

Public Properties

Property Type Description
$allowExts 允许上传的文件后缀,留空不作后缀检查
$allowTypes 允许上传的文件类型,留空不做检查
$autoCheck
$customPath 上传文件保存路径
$hashType 上传文件Hash规则函数名,可以是 md5_file sha1_file 等
$maxSize 上传文件的最大值
$saveName
$savePath
$thumb 使用对上传图片进行缩略图处理
$thumbMaxHeight 缩略图最大高度
$thumbMaxWidth 缩略图最大宽度

Public Methods

Method Description
__construct ( ) 构造函数
deleteFile ( string $filename ) : boolean 删除文件
getConfig ( ) 获取又拍云配置
getErrorMsg ( ) : string 取得最后一次错误信息
getFileInfo ( $filename )
getImageInfo ( $filename ) 获取上传图片信息
getImageUrl ( $filename, $width, $height, $cut ) 获取上传地址
getPolicy ( ) 获取policy
getPolicydoc ( ) 获取表单API相关信息
getSignature ( ) 获取signature
getUploadFileInfo ( ) : array 取得上传文件的信息
getUploadUrl ( ) 获取上传地址
getUrlPrefix ( ) 获取附件URL前缀
isOpen ( ) 是否开启Upyun
upload ( string $savePath = '' ) : string 上传文件
writeFile ( string $filename, string $filecontent ) : boolean 写入文件

Protected Methods

Method Description
error ( string $errorNo ) 获取错误代码信息

Private Methods

Method Description
check ( array $file ) : boolean 检查上传的文件
checkExt ( string $ext ) : boolean 检查上传的文件后缀是否合法
checkSize ( integer $size ) : boolean 检查文件大小是否合法
checkType ( string $type ) : boolean 检查上传的文件类型是否合法
checkUpload ( string $filename ) : boolean 检查文件是否非法提交
dealFiles ( array $files ) : array 转换上传文件数组变量为正确的方式
getExt ( string $filename ) : boolean 取得上传文件的后缀

Method Details

__construct() public method

构造函数
public __construct ( )

deleteFile() public method

删除文件
public deleteFile ( string $filename ) : boolean
$filename string 文件相对路径
return boolean

error() protected method

获取错误代码信息
protected error ( string $errorNo )
$errorNo string 错误号码

getConfig() public method

获取又拍云配置
public getConfig ( )

getErrorMsg() public method

取得最后一次错误信息
public getErrorMsg ( ) : string
return string

getFileInfo() public method

public getFileInfo ( $filename )

getImageInfo() public method

获取上传图片信息
public getImageInfo ( $filename )

getImageUrl() public method

获取上传地址
public getImageUrl ( $filename, $width, $height, $cut )

getPolicy() public method

获取policy
public getPolicy ( )

getPolicydoc() public method

获取表单API相关信息
public getPolicydoc ( )

getSignature() public method

获取signature
public getSignature ( )

getUploadFileInfo() public method

取得上传文件的信息
public getUploadFileInfo ( ) : array
return array

getUploadUrl() public method

获取上传地址
public getUploadUrl ( )

getUrlPrefix() public method

获取附件URL前缀
public getUrlPrefix ( )

isOpen() public method

是否开启Upyun
public isOpen ( )

upload() public method

上传文件
public upload ( string $savePath = '' ) : string
$savePath string 上传文件保存路径
return string

writeFile() public method

写入文件
public writeFile ( string $filename, string $filecontent ) : boolean
$filename string 文件相对路径
$filecontent string 文件数据
return boolean

Property Details

$allowExts public_oe property

允许上传的文件后缀,留空不作后缀检查
public $allowExts

$allowTypes public_oe property

允许上传的文件类型,留空不做检查
public $allowTypes

$autoCheck public_oe property

public $autoCheck

$customPath public_oe property

上传文件保存路径
public $customPath

$hashType public_oe property

上传文件Hash规则函数名,可以是 md5_file sha1_file 等
public $hashType

$maxSize public_oe property

上传文件的最大值
public $maxSize

$saveName public_oe property

public $saveName

$savePath public_oe property

public $savePath

$thumb public_oe property

使用对上传图片进行缩略图处理
public $thumb

$thumbMaxHeight public_oe property

缩略图最大高度
public $thumbMaxHeight

$thumbMaxWidth public_oe property

缩略图最大宽度
public $thumbMaxWidth