class Filehandler

Properties

string $destinationpath
array $fileinfo
string $destinationfile
array $errors
string $path_zip

Methods

__construct()

Filehandler constructor.

void
add_file(string $destinationpath, string $destinationfile, string $sourcefile)

No description

add_to_zip(string $file)

No description

checkTypes(array $extensions)

No description

create_zip_archive(array $filelist, string $zip_file_name, string|bool $zip_root_path = false, bool $storepaths = true, bool $send_to_browser = false, bool $die_when_sent = true)

Creates a ZIP archive of passed files and stores on HDD or sends it on the fly to the browser You should use this function instead of the separate functions above

bool
deflate_zip($source, $destination)

No description

bool
download_file(string $base_dir)

Initiates download of the via GPvars[download_id] passed file link

false|string
get_cached_imageresize(string $image_file, int $width, int $height, array $download_params = array())

No description

string
get_download_id(string $file, string|bool $filename = false, string|bool $mime = false, bool $save = false, bool $zip = false)

Returns a download ID for the given file

bool
get_image(string $imagefile, mixed $memory_factor = 1)

Get Image from File Path

string
get_order_id(string $file, string $label, string $path, string|bool $filename = false)

Returns a order ID for the given file

bool
get_zip(string $zip_filename, string|bool $send_file_name = false, bool $die_when_sent = true)

No description

array
gif_info($filename)

No description

bool|null|string
imageResize(string $image_file, mixed $width, mixed $height, string $output_image = 'SOURCE', mixed $params = array())

Resizes the passed image to the given size.

image_crop(int $image_file_path, int $w, int $h, int $x, int $y, int $rotate = 0, string $target_file_path = null)

No description

string
increase_memory_limit(string $imagefile, float $memory_factor = 1.0)

Returns an GD Image Ressource of the passed file

void
process(string $scenario = 'manual', array|bool $params = false)

No description

bool
process_zip(string $zip_filename, string|bool $zip_root_path = false, bool $storepaths = true)

No description

bool
save()

No description

bool
save_image(mixed $dst_img, mixed $output_image, string $ext = 'jpg', int $quality = 90)

Saves the passed GD image ressource to the specified file

Details

at line 48
__construct()

Filehandler constructor.

at line 71
void add_file(string $destinationpath, string $destinationfile, string $sourcefile)

No description

Parameters

string $destinationpath

Destination Path (Where your file will be saved after processing)

string $destinationfile

Filename (Save File as..)

string $sourcefile

Path to your file (Open file..)

Return Value

void

at line 1016
add_to_zip(string $file)

No description

Parameters

string $file

path and filename of the file to be added

at line 262
checkTypes(array $extensions)

No description

Parameters

array $extensions

at line 1108
create_zip_archive(array $filelist, string $zip_file_name, string|bool $zip_root_path = false, bool $storepaths = true, bool $send_to_browser = false, bool $die_when_sent = true)

Creates a ZIP archive of passed files and stores on HDD or sends it on the fly to the browser You should use this function instead of the separate functions above

Parameters

array $filelist

Array with file paths

string $zip_file_name

Name/Folder of ZIP to create, if sent to browser is true filename is sufficient

string|bool $zip_root_path

Rootfolder of filelist filepaths, used for relative paths

bool $storepaths

Include path information in ZIP

bool $send_to_browser

Send ZIP directly to browser

bool $die_when_sent

Disable Die After Sent to execute additional commands then send to browser is enabled

at line 1203
bool deflate_zip($source, $destination)

No description

Parameters

$source
$destination

Return Value

bool

success

at line 901
bool download_file(string $base_dir)

Initiates download of the via GPvars[download_id] passed file link

Parameters

string $base_dir

Base directory of the file

Return Value

bool

Returns true of the file could be successfully passed on

at line 321
false|string get_cached_imageresize(string $image_file, int $width, int $height, array $download_params = array())

No description

Parameters

string $image_file

file

int $width
int $height
array $download_params

additional params from download handling

Return Value

false|string

Returns false if neither width nor height are given

at line 967
string get_download_id(string $file, string|bool $filename = false, string|bool $mime = false, bool $save = false, bool $zip = false)

Returns a download ID for the given file

Parameters

string $file

physical file of the file to download

string|bool $filename

(can be different from the physical file name)

string|bool $mime

MIME definition of the file (if not passed the MIME type will be detected based on the file extension)

bool $save

Set TRUE if file should be saved instead of directly viewed

bool $zip

Set TRUE if file should be send as ZIP archive

Return Value

string

Returns the encrypted download_id of the passed file

at line 463
bool get_image(string $imagefile, mixed $memory_factor = 1)

Get Image from File Path

Parameters

string $imagefile
mixed $memory_factor

Return Value

bool

at line 998
string get_order_id(string $file, string $label, string $path, string|bool $filename = false)

Returns a order ID for the given file

Parameters

string $file

physical file of the file to download

string $label

of the file displayed on the order form

string $path

where the file is located

string|bool $filename

of the file (can be different from the physical file name)

Return Value

string

Returns the encrypted download_id of the passed file

at line 1068
bool get_zip(string $zip_filename, string|bool $send_file_name = false, bool $die_when_sent = true)

No description

Parameters

string $zip_filename

name of the zip file

string|bool $send_file_name
bool $die_when_sent

Return Value

bool

at line 866
array gif_info($filename)

No description

Parameters

$filename

Return Value

array

at line 290
bool|null|string imageResize(string $image_file, mixed $width, mixed $height, string $output_image = 'SOURCE', mixed $params = array())

Resizes the passed image to the given size.

Parameters

string $image_file

Image File Path

mixed $width
mixed $height
string $output_image

Output Image File Path

mixed $params

(fileExt (Force using a certain file ext), mode (resize mode: crop, resize))

Return Value

bool|null|string

at line 306
image_crop(int $image_file_path, int $w, int $h, int $x, int $y, int $rotate = 0, string $target_file_path = null)

No description

Parameters

int $image_file_path
int $w
int $h
int $x
int $y
int $rotate

Degree as integer

string $target_file_path

at line 419
string increase_memory_limit(string $imagefile, float $memory_factor = 1.0)

Returns an GD Image Ressource of the passed file

Parameters

string $imagefile

Filename on HDD

float $memory_factor

Memory Limit Factor (1 = normal resize, 1.5 = rotation )

Return Value

string

Returns GDLib Object

at line 91
void process(string $scenario = 'manual', array|bool $params = false)

No description

Parameters

string $scenario

Scenario [multiple scenarios with comma separated]: 'manual', 'imageupload' ,'binarytotmp', 'unique', 'overwrite'

array|bool $params

Params for Scenarios such as 'maxwidth','maxheight','filename'

Return Value

void

at line 1030
bool process_zip(string $zip_filename, string|bool $zip_root_path = false, bool $storepaths = true)

No description

Parameters

string $zip_filename

of the zip file

string|bool $zip_root_path

if the files were given relative in add_to_zip

bool $storepaths

Return Value

bool

at line 211
bool save()

No description

Return Value

bool

success (Access errors via property 'errors')

at line 515
bool save_image(mixed $dst_img, mixed $output_image, string $ext = 'jpg', int $quality = 90)

Saves the passed GD image ressource to the specified file

Parameters

mixed $dst_img

GD Image Ressource

mixed $output_image

Destination Filepath

string $ext

Filetype (extension)

int $quality

Quality for JPG

Return Value

bool