Documentation

Image extends File

Table of Contents

FORMAT  = ['WebP' => 'webp', 'JPG' => 'jpg', 'PNG' => 'png']
MIME_TYPES  = ['image/jpeg' => 'jpg', 'image/png' => 'png', 'image/webp' => 'webp']
$image  : Imagick
$dirname  : string
$extension  : string
$mimeType  : string
$path  : string
$uploadName  : string
$filename  : string
__construct()  : mixed
__destruct()  : mixed
clone()  : File
Clone file
copy()  : File
Copy file to destination
delete()  : void
Delete file
generateThumbnails()  : array<string|int, string>
Return thumbnail sources
getBasename()  : string
Returns basename
getDirname()  : string
Returns directory
getFilename()  : string
Returns filename
getMimeType()  : string
Return file mime type
getPath()  : string
Returns path
getUploadName()  : string|null
Returns upload name
isImage()  : bool
Checks if file is image
move()  : self
Moves file to new location
rename()  : self
Rename file
resize()  : void
Resizes image
save()  : self
Saves image
saveAs()  : self
Saves image as
setExtension()  : self
Set file extension
setFormat()  : self
Sets image format
setQuality()  : self
Change quality of jpeg
setUploadName()  : self
Sets upload name
toImage()  : Image
Creates image from file
setMimeType()  : self
Sets mime type
setPath()  : self
Sets file path
mimeTypeToExtension()  : string
Mime to extension
setPermitions()  : self
Sets file permitions

Constants

FORMAT

public array<string|int, string> FORMAT = ['WebP' => 'webp', 'JPG' => 'jpg', 'PNG' => 'png']

MIME_TYPES

public array<string|int, string> MIME_TYPES = ['image/jpeg' => 'jpg', 'image/png' => 'png', 'image/webp' => 'webp']

Properties

$image

public Imagick $image

$dirname

protected string $dirname

$extension

protected string $extension

$mimeType

protected string $mimeType

$path

protected string $path

$uploadName

protected string $uploadName

$filename

private string $filename

Methods

__construct()

public __construct(string $path) : mixed
Parameters
$path : string
Return values
mixed

__destruct()

public __destruct() : mixed
Return values
mixed

clone()

Clone file

public clone() : File
Return values
File

copy()

Copy file to destination

public copy(string $destination) : File
Parameters
$destination : string
Return values
File

delete()

Delete file

public delete() : void
Return values
void

generateThumbnails()

Return thumbnail sources

public generateThumbnails(array<string|int, array<string|int, int>> $thumbnailDimensions[, string $format = '' ]) : array<string|int, string>
Parameters
$thumbnailDimensions : array<string|int, array<string|int, int>>
$format : string = ''
Return values
array<string|int, string>

getBasename()

Returns basename

public getBasename() : string
Return values
string

getDirname()

Returns directory

public getDirname() : string
Return values
string

getFilename()

Returns filename

public getFilename() : string
Return values
string

getMimeType()

Return file mime type

public getMimeType() : string
Return values
string

getPath()

Returns path

public getPath() : string
Return values
string

getUploadName()

Returns upload name

public getUploadName() : string|null
Return values
string|null

isImage()

Checks if file is image

public isImage() : bool
Return values
bool

move()

Moves file to new location

public move(string $destination) : self
Parameters
$destination : string
Return values
self

rename()

Rename file

public rename(string $filename) : self
Parameters
$filename : string
Return values
self

resize()

Resizes image

public resize(int $width, int $height) : void
Parameters
$width : int
$height : int
Return values
void

save()

Saves image

public save() : self
Return values
self

saveAs()

Saves image as

public saveAs(string $filename) : self
Parameters
$filename : string
Return values
self

setExtension()

Set file extension

public setExtension(string $extension) : self
Parameters
$extension : string
Return values
self

setFormat()

Sets image format

public setFormat(string $format) : self
Parameters
$format : string
Return values
self

setQuality()

Change quality of jpeg

public setQuality(int $quality) : self
Parameters
$quality : int
Return values
self

setUploadName()

Sets upload name

public setUploadName(string $name) : self
Parameters
$name : string
Return values
self

toImage()

Creates image from file

public toImage() : Image
Return values
Image

setMimeType()

Sets mime type

protected setMimeType() : self
Return values
self

setPath()

Sets file path

protected setPath(string $path) : self
Parameters
$path : string
Return values
self

mimeTypeToExtension()

Mime to extension

private mimeTypeToExtension(string $mime) : string
Parameters
$mime : string
Return values
string

setPermitions()

Sets file permitions

private setPermitions(int $permitions) : self
Parameters
$permitions : int
Return values
self

Search results