Properties

$upload_temp

$upload_temp

$upload_baseurl

$upload_baseurl

$upload_basedir

$upload_basedir

$fonticon

$fonticon : array|array[]

Type

normal

$upload_dir

$upload_dir : null|string

Type

normal

$upload_temp_url

$upload_temp_url : null

Type

normal

$default_file_fonticon

$default_file_fonticon : string

Type

normal

Methods

__construct()

__construct() : mixed

Files constructor.

Returns

mixed

get_download_link()

get_download_link(int  $form_id, string  $field_key, int  $user_id) : string

File download link generate

Parameters

int $form_id
string $field_key
int $user_id

Returns

string

download_routing()

download_routing() : bool

Returns

bool

image_download()

image_download( $user_id,  $field_key,  $field_value) : mixed

Parameters

$user_id
$field_key
$field_value

Returns

mixed

file_download()

file_download( $user_id,  $field_key,  $field_value) : mixed

Parameters

$user_id
$field_key
$field_value

Returns

mixed

ajax_remove_file()

ajax_remove_file() : mixed

Remove file by AJAX

Returns

mixed

ajax_resize_image()

ajax_resize_image() : mixed

Resize image AJAX handler

Returns

mixed

ajax_image_upload()

ajax_image_upload() : mixed

Image upload by AJAX

Throws

\Exception

Returns

mixed

ajax_file_upload()

ajax_file_upload() : mixed

File upload by AJAX

Returns

mixed

allowed_image_types()

allowed_image_types() : array

Allowed image types

Returns

array

allowed_file_types()

allowed_file_types() : mixed

Allowed file types

Returns

mixed

get_fonticon_by_ext()

get_fonticon_by_ext( $extension) : string

Get extension icon

Parameters

$extension

Returns

string

get_fonticon_bg_by_ext()

get_fonticon_bg_by_ext( $extension) : string

Get extension icon background

Parameters

$extension

Returns

string

setup_paths()

setup_paths() : mixed

Setup upload directory

Returns

mixed

unique_dir()

unique_dir() : mixed

Generate unique temp directory

Returns

mixed

path_only()

path_only( $file) : string

Get path only without file name

Parameters

$file

Returns

string

fix_image_orientation()

fix_image_orientation( $rotate,  $source) : resource

Fix image orientation

Parameters

$rotate
$source

Returns

resource

create_and_copy_image()

create_and_copy_image( $source,  $destination, int  $quality = 100) : array

Process an image

Parameters

$source
$destination
int $quality

Returns

array

upload_temp_file()

upload_temp_file( $source,  $destination) : mixed

Process a file

Parameters

$source
$destination

Returns

mixed

new_image_upload_temp()

new_image_upload_temp( $source,  $destination, int  $quality = 100) : string

Process a temp upload

Parameters

$source
$destination
int $quality

Returns

string

new_file_upload_temp()

new_file_upload_temp( $source,  $destination) : string

Process a temp upload for files

Parameters

$source
$destination

Returns

string

make_dir()

make_dir( $dir) : mixed

Make a Folder

Parameters

$dir

Returns

mixed

get_extension_by_mime_type()

get_extension_by_mime_type( $mime) : mixed

Get extension by mime type

Parameters

$mime

Returns

mixed

get_file_data()

get_file_data( $file) : mixed

Get file data

Parameters

$file

Returns

mixed

get_image_data()

get_image_data( $file) : mixed

Get image data

Parameters

$file

Returns

mixed

in_array()

in_array( $value,  $array) : bool

If a value exists in comma seperated list

Parameters

$value
$array

Returns

bool

delete_file()

delete_file(string  $src) : bool

This function will delete file upload from server

Parameters

string $src

Returns

bool

delete_core_user_photo()

delete_core_user_photo( $user_id,  $type) : mixed

Delete a main user photo

Parameters

$user_id
$type

Returns

mixed

resize_image()

resize_image( $file,  $crop) : string

Resize a local image

Parameters

$file
$crop

Returns

string

new_user()

new_user( $user_id) : mixed

Make a user folder for uploads

Parameters

$user_id

Returns

mixed

new_user_upload()

new_user_upload( $user_id,  $source,  $key) : string

New user upload

Parameters

$user_id
$source
$key

Returns

string

remove_dir()

remove_dir( $dir) : mixed

Remove a directory

Parameters

$dir

Returns

mixed

remove_old_files()

remove_old_files(string  $dir, int|string  $timestamp = NULL) : mixed

Remove old files

Parameters

string $dir

Path to directoty.

int|string $timestamp

Unix timestamp or PHP relative time. All older files will be removed.

Returns

mixed

format_bytes()

format_bytes( $size, int  $precision = 1) : string

Format Bytes

Parameters

$size
int $precision

Returns

string

get_profile_photo_size()

get_profile_photo_size(string  $type) : array

Get the list of profile/cover sizes

Parameters

string $type

Returns

array