class DefaultFileProvider implements FileContract

图片上传类

Traits

AppTrait

Properties

protected Resp $error error from  AppTrait
protected Resp $success success from  AppTrait
protected string $destination
protected string $disk
protected bool $watermark 是否启用水印
protected int|null $resizeLongDistrict 长边限制

Methods

getError()

获取错误

from  AppTrait
bool
setError(string|MessageBag $error)

设置错误

from  AppTrait
getSuccess()

Get success messages;

from  AppTrait
bool
setSuccess(Resp|string $success)

No description

from  AppTrait
__construct()

上传文件夹地址

mixed
setFolder($folder = 'uploads')

重新设置存储文件夹

mixed
setType(string $type)

设置类型

FilesystemAdapter
storage()

获取本地磁盘存储

setExtension(array $extension = [])

Set Extension

setResizeDistrict(int $resize)

District Size.

setQuality(int $quality)

设置图片压缩质量

setMimeType($mime_type)

设置图片mime类型

bool
saveFile(UploadedFile $file)

No description

StreamInterface
resize(mixed $content, int $width = 1920, int $height = 1440, bool $crop = false)

No description

bool
saveInput(mixed $content)

No description

string
getDestination()

获取目标路径

setDestination(string $destination)

No description

string
getUrl()

No description

string
getReturnUrl()

No description

setReturnUrl(string $url)

设置返回地址

setIsForceSetDestination(bool $isForceSetDestination)

No description

bool
copyTo(string $dist)

No description

bool
delete()

No description

void
enableWatermark()

No description

Details

in AppTrait at line 32
Resp getError()

获取错误

Return Value

Resp

in AppTrait at line 45
bool setError(string|MessageBag $error)

设置错误

Parameters

string|MessageBag $error error

Return Value

bool

in AppTrait at line 82
Resp getSuccess()

Get success messages;

Return Value

Resp

in AppTrait at line 100
bool setSuccess(Resp|string $success)

No description

Parameters

Resp|string $success 设置的成功信息

Return Value

bool

at line 91
__construct()

上传文件夹地址

at line 98
mixed setFolder($folder = 'uploads')

重新设置存储文件夹

Parameters

$folder

Return Value

mixed

at line 108
mixed setType(string $type)

设置类型

Parameters

string $type

Return Value

mixed

at line 120
FilesystemAdapter storage()

获取本地磁盘存储

Return Value

FilesystemAdapter

at line 133
setExtension(array $extension = [])

Set Extension

Parameters

array $extension 支持的扩展

at line 143
setResizeDistrict(int $resize)

District Size.

Parameters

int $resize

设置resize 的区域

at line 154
setQuality(int $quality)

设置图片压缩质量

Parameters

int $quality

at line 165
setMimeType($mime_type)

设置图片mime类型

Parameters

$mime_type

at line 175
bool saveFile(UploadedFile $file)

No description

Parameters

UploadedFile $file

file 对象

Return Value

bool

Exceptions

ApplicationException

at line 227
StreamInterface resize(mixed $content, int $width = 1920, int $height = 1440, bool $crop = false)

No description

Parameters

mixed $content 需要压缩的内容
int $width 宽度
int $height 高度
bool $crop 是否进行裁剪

Return Value

StreamInterface

at line 268
bool saveInput(mixed $content)

No description

Parameters

mixed $content 内容流

Return Value

bool

Exceptions

ApplicationException

at line 305
string getDestination()

获取目标路径

Return Value

string

at line 313
setDestination(string $destination)

No description

Parameters

string $destination 设置目标地址

at line 322
string getUrl()

No description

Return Value

string

at line 331
string getReturnUrl()

No description

Return Value

string

at line 340
setReturnUrl(string $url)

设置返回地址

Parameters

string $url 地址

at line 353
setIsForceSetDestination(bool $isForceSetDestination)

No description

Parameters

bool $isForceSetDestination

at line 362
bool copyTo(string $dist)

No description

Parameters

string $dist 目标路径

Return Value

bool

at line 374
bool delete()

No description

Return Value

bool

at line 385
void enableWatermark()

No description

Return Value

void