\App\ServicesImageUpload

Summary

Methods
Properties
Constants
__construct()
uploadImage()
No public properties found
No constants found
checkAllowedExtensionsOrFail()
saveImageToLocal()
$file
$allowed_extensions
$height_arr
N/A
No private methods found
No private properties found
N/A

Properties

$file

$file : \Symfony\Component\HttpFoundation\File\UploadedFile

Type

\Symfony\Component\HttpFoundation\File\UploadedFile

$allowed_extensions

$allowed_extensions : 

Type

$height_arr

$height_arr : 

Type

Methods

__construct()

__construct() 

uploadImage()

uploadImage(  $file) : array

上传图片

Parameters

$file

UploadedFile

Returns

array —

返回上传图片的路径数组

checkAllowedExtensionsOrFail()

checkAllowedExtensionsOrFail() 

saveImageToLocal()

saveImageToLocal(  $type,   $resize,   $filename = '') : array

保存图片到本地

Parameters

$type

string 图片类型 topic 一般图片,avatar 头像

$resize

int 最大宽度

$filename

string 设置文件名

Returns

array —

文件存储路径