PHP Class Uploadcare\File

Afficher le fichier Open project: uploadcare/uploadcare-php Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( string $uuid_or_url, Api $api, boolean | array | object $data = false ) Constructs an object for CDN file with specified ID
__get ( $name ) : array | null
__toString ( ) : string
copy ( string $target = null ) : File | string Copy the file.
copyTo ( string $target ) : string Copy the file to custom storage.
crop ( integer $width, integer $height, boolean $center = false, string | boolean $fill_color = false ) : File Get object with cropped parameters.
delete ( ) : array Delete file
effect ( string $effect ) : File Apply effect
getFileId ( ) : string Get UUID
getImgTag ( string $postfix = null, array $attribs = [] ) : string Get image tag
getUrl ( string $postfix = null ) : string Get url of original image
getUuid ( ) Get UUID
op ( string $operation ) : File Add any custom operation.
preview ( integer $width, integer $height ) : File Get object with preview parameters.
resize ( integer | boolean $width = false, integer | boolean $height = false ) : File Get object with resized parameters.
scaleCrop ( integer $width, integer $height, boolean $center = false ) : File Get object with cropped parameters.
store ( ) : array Store file.
updateInfo ( ) : array Update File info

Private Methods

Méthode Description
__addPartCenter ( array $part, array $params ) : array Adds part with center for operations
__addPartEffect ( array $part, string $effect ) : array Adds part with effect for operations
__addPartFillColor ( array $part, array $params ) : array Adds part with fill color for operations
__addPartSize ( array $part, array $params ) : array Adds part with size for operations

Method Details

__construct() public méthode

Constructs an object for CDN file with specified ID
public __construct ( string $uuid_or_url, Api $api, boolean | array | object $data = false )
$uuid_or_url string Uploadcare file UUID or CDN URL
$api Api Uploadcare class instance
$data boolean | array | object prepopulate this->cached_data

__get() public méthode

public __get ( $name ) : array | null
$name
Résultat array | null

__toString() public méthode

public __toString ( ) : string
Résultat string

copy() public méthode

Copy the file.
public copy ( string $target = null ) : File | string
$target string Name of custom storage.
Résultat File | string

copyTo() public méthode

Copy the file to custom storage.
public copyTo ( string $target ) : string
$target string Name of custom storage.
Résultat string

crop() public méthode

Get object with cropped parameters.
public crop ( integer $width, integer $height, boolean $center = false, string | boolean $fill_color = false ) : File
$width integer Crop width
$height integer Crop height
$center boolean Center crop? true or false (default false).
$fill_color string | boolean Fill color. If nothing is provided just use false (default false).
Résultat File

delete() public méthode

Delete file
public delete ( ) : array
Résultat array

effect() public méthode

Apply effect
public effect ( string $effect ) : File
$effect string Effect name
Résultat File

getFileId() public méthode

Get UUID
Deprecation:
public getFileId ( ) : string
Résultat string

getImgTag() public méthode

Get image tag
public getImgTag ( string $postfix = null, array $attribs = [] ) : string
$postfix string File path postfix
$attribs array additional attributes
Résultat string

getUrl() public méthode

Get url of original image
public getUrl ( string $postfix = null ) : string
$postfix string
Résultat string

getUuid() public méthode

Get UUID
public getUuid ( )

op() public méthode

Add any custom operation.
public op ( string $operation ) : File
$operation string
Résultat File

preview() public méthode

Provide both width and height. If no width and height are provided exceptions will be thrown!
public preview ( integer $width, integer $height ) : File
$width integer Preview image width.
$height integer Preview image height.
Résultat File

resize() public méthode

Provide width or height or both. If not width or height are provided exceptions will be thrown!
public resize ( integer | boolean $width = false, integer | boolean $height = false ) : File
$width integer | boolean Resized image width. Provide false if you resize proportionally.
$height integer | boolean Resized image height. Provide false if you resize proportionally.
Résultat File

scaleCrop() public méthode

Get object with cropped parameters.
public scaleCrop ( integer $width, integer $height, boolean $center = false ) : File
$width integer Crop width
$height integer Crop height
$center boolean Center crop? true or false (default false).
Résultat File

store() public méthode

Store file.
public store ( ) : array
Résultat array

updateInfo() public méthode

Update File info
public updateInfo ( ) : array
Résultat array