UploadFile
in package
implements
UploadFile
Class UploadFile.
Tags
Table of Contents
Interfaces
Properties
- $base64 : string|null
- $itemType : string|null
- $options : array<string|int, mixed>|array<string|int, string>
- $path : string
- $resizeImage : ResizeImageInterface
- $storageId : string
- $user : User|null
Methods
- __construct() : mixed
- asUploadedFile() : UploadedFile
- Convert local file path to uploaded file.
- convertBase64ToUploadedFile() : UploadedFile
- convertFile() : UploadedFile|null
- convertImageToBase64() : string
- getBase64() : string|null
- getFile() : StorageFile
- getFileId() : int|null
- getResizeImage() : ResizeImageInterface
- getStorage() : string
- Get storage server id.
- isImage() : bool
- pathToUploadedFile() : UploadedFile
- rollUp() : bool
- setBase64() : $this
- setItemType() : UploadFile
- setPath() : static
- setStorage() : $this
- Where to storage file etc.
- setThumbSizes() : self
- Thumb sizes configure at "./config/image.php".
- setUser() : $this
- storeAttachment() : Attachment
- storeAttachments() : array<string|int, Attachment>
- storeFile() : StorageFile
- storeFiles() : array<string|int, StorageFile>
- uploadWithParams() : StorageFile
- getConverter() : FileConverterInterface|null
- handleBase64() : string|null
- getFileName() : string
- Generate file name.
Properties
$base64
protected
string|null
$base64
= null
$itemType
private
string|null
$itemType
= null
$options
private
array<string|int, mixed>|array<string|int, string>
$options
= ['visibility' => 'public']
$path
private
string
$path
= 'files'
$resizeImage
private
ResizeImageInterface
$resizeImage
$storageId
private
string
$storageId
= 'photo'
$user
private
User|null
$user
= null
Methods
__construct()
public
__construct(ResizeImageInterface $resizeImage) : mixed
Parameters
- $resizeImage : ResizeImageInterface
asUploadedFile()
Convert local file path to uploaded file.
public
asUploadedFile(string $realpath[, mixed $originalName = null ][, bool $testMode = false ]) : UploadedFile
Parameters
- $realpath : string
- $originalName : mixed = null
- $testMode : bool = false
Return values
UploadedFileconvertBase64ToUploadedFile()
public
convertBase64ToUploadedFile(string $imageBase64) : UploadedFile
Parameters
- $imageBase64 : string
Return values
UploadedFileconvertFile()
public
convertFile(UploadedFile $file) : UploadedFile|null
Parameters
- $file : UploadedFile
Tags
Return values
UploadedFile|nullconvertImageToBase64()
public
convertImageToBase64(string $realpath) : string
Parameters
- $realpath : string
Return values
stringgetBase64()
public
getBase64() : string|null
Return values
string|nullgetFile()
public
getFile(int $id) : StorageFile
Parameters
- $id : int
Return values
StorageFilegetFileId()
public
getFileId(int|null $tempFileId[, bool $rollUp = false ]) : int|null
Parameters
- $tempFileId : int|null
- $rollUp : bool = false
Return values
int|nullgetResizeImage()
public
getResizeImage() : ResizeImageInterface
Return values
ResizeImageInterfacegetStorage()
Get storage server id.
public
getStorage() : string
Return values
stringisImage()
public
isImage(UploadedFile $file) : bool
Parameters
- $file : UploadedFile
Return values
boolpathToUploadedFile()
public
static pathToUploadedFile(string $realpath[, string $newFileName = null ][, bool $isTestMode = true ]) : UploadedFile
Parameters
- $realpath : string
- $newFileName : string = null
- $isTestMode : bool = true
Tags
Return values
UploadedFilerollUp()
public
rollUp(int $id) : bool
Parameters
- $id : int
Return values
boolsetBase64()
public
setBase64(string|null $base64) : $this
Parameters
- $base64 : string|null
Return values
$thissetItemType()
public
setItemType(string|null $itemType) : UploadFile
Parameters
- $itemType : string|null
Return values
UploadFilesetPath()
public
setPath(string $path) : static
Parameters
- $path : string
Return values
staticsetStorage()
Where to storage file etc.
public
setStorage(mixed $storageId) : $this
Parameters
- $storageId : mixed
-
Example: "photo", "video", "temporary", "attachment"
Return values
$thissetThumbSizes()
Thumb sizes configure at "./config/image.php".
public
setThumbSizes(array<string|int, int> $sizes) : self
Parameters
- $sizes : array<string|int, int>
Return values
selfsetUser()
public
setUser(User|null $user) : $this
Parameters
- $user : User|null
Return values
$thisstoreAttachment()
public
storeAttachment(UploadedFile $file) : Attachment
Parameters
- $file : UploadedFile
Return values
AttachmentstoreAttachments()
public
storeAttachments(array<string|int, mixed> $files) : array<string|int, Attachment>
Parameters
- $files : array<string|int, mixed>
Return values
array<string|int, Attachment>storeFile()
public
storeFile(UploadedFile $uploadedFile) : StorageFile
Parameters
- $uploadedFile : UploadedFile
Return values
StorageFilestoreFiles()
public
storeFiles(array<string|int, mixed> $files) : array<string|int, StorageFile>
Parameters
- $files : array<string|int, mixed>
Return values
array<string|int, StorageFile>uploadWithParams()
public
uploadWithParams(UploadedFile $file[, array<string|int, mixed> $params = [] ]) : StorageFile
Parameters
- $file : UploadedFile
- $params : array<string|int, mixed> = []
Tags
Return values
StorageFilegetConverter()
protected
getConverter([string|null $mimeType = null ]) : FileConverterInterface|null
Parameters
- $mimeType : string|null = null
Tags
Return values
FileConverterInterface|nullhandleBase64()
protected
handleBase64(UploadedFile $uploadedFile) : string|null
Parameters
- $uploadedFile : UploadedFile
Return values
string|nullgetFileName()
Generate file name.
private
getFileName(UploadedFile $file) : string
Parameters
- $file : UploadedFile