Method |
Description |
|
__construct ( ) |
Constructor |
|
_addError ( string $msg ) : void |
Adds an error, legacy from the component |
|
_arrayMerge ( array $arr, array $ins ) : array |
Merges two arrays recursively |
|
_copyFileFromTemp ( string $tmpName, string $saveAs, integer $filePermission ) : mixed |
Copies file from temporary directory to final destination |
|
_createFolders ( string $dir, string $thumbDir, array $thumbsizes, integer $folderPermission ) : void |
Creates thumbnail folders if they do not already exist |
|
_createThumbnail ( object &$model, string $source, string $target, string $fieldName, array $params = [] ) : void |
Function to create Thumbnail images |
|
_createThumbnails ( object &$model, array $data, string $fieldName, $saveAs, string $ext, array $options ) : void |
Create all the thumbnails |
|
_deleteFiles ( object &$model, string $field, string $filename, stirng $dir ) : boolean |
Delete the $filename inside the $dir and the thumbnails. |
|
_deleteFilesList ( object &$model ) : void |
Deletes the files marked to be deleted in the save method. |
|
_fixName ( object &$model, string $fieldName, boolean $checkFile = true ) : void |
Removes the bad characters from the $filename and replace reserved words. It updates the $model->data. |
|
_getThumbnailName ( string $saveAs, string $dir, string $thumbDir, string $key, string $fieldToSaveAs, string $sub = null ) : string |
Generate the name for the thumbnail
If a 'normal' thumbnail is set, then it will overwrite the original file |
|
_includeDefaultReplacement ( string $default ) : void |
Include a pattern of reserved word based on a filename, and it's replacement. |
|
_markForDeletion ( object &$model, string $fieldName, array $data, strng $default, string $thumbDir ) : void |
Marks files for deletion in the beforeSave() callback |
|
_nullifyDataFields ( object &$model, string $fieldName, array $data, array $options ) : array |
Sets as NULL data from $data
Useful when deleting a file. |
|
_removeOriginal ( string $saveAs ) : boolean |
Remove original file |
|
_replaceTokens ( object &$model, string $string, string $fieldName, array $tokens = [] ) : string |
Replaces some tokens. {ModelName} to the underscore version of the model name
{fieldName} to the field name, {DS}. / or \ to DS constant value. |
|
_setFileToRemove ( object &$model, sting $fieldName, string $thumbDir ) : void |
Set a file to be removed in afterSave() callback |
|
_setupValidation ( object &$model, string $fieldName, array $options ) : void |
Sets the validation for each field, based on the options. |
|
_sizeToBytes ( string $size ) : integer |
Convert a size value to bytes. For example: 2 MB to 2097152. |
|
_splitFilenameAndExt ( string $filename ) : array |
Splits a filename in two parts: the name and the extension. Returns an array with it respectively. |
|
_unsetDataFields ( string $modelName, string $fieldName, array $data, array $options ) : array |
Unsets data from $data
Useful for no-db upload |
|
_uploadCheckSize ( object &$model, array &$data, string $type ) : boolean |
Check generic to size of image |
|
_uploadFile ( object &$model, array $data = null ) : mixed |
Uploads the files |
|
afterDelete ( Model $model ) : void |
After delete (callback) |
|
afterSave ( Model $model, $created ) : void |
After save (callback) |
|
beforeDelete ( Model $model, $cascade = true ) : boolean |
Deletes all files associated with the record beforing delete it. |
|
beforeSave ( Model $model ) : boolean |
Initializes the upload |
|
beforeValidate ( Model $model ) : boolean |
Sets the validation rules for each field. |
|
regenerateThumbnails ( Model $model ) |
Regenerate all the thumbnails, for all fields that have thumbSizes, for records in the table. (used, eg, when you want to add or change thumbnail sizes)
This will overwrite existing thumbnails, when they exist, so a backup of thumbnails should be done before hand. |
|
setup ( Model $model, array $settings = [] ) : void |
Setup the behavior. It stores a reference to the model, merges the default options with the options for each field, and setup the validation rules. |
|
upload ( object &$model, array $data ) : boolean |
Performs a manual upload |
|
uploadCheckDir ( object &$model, array $data ) : boolean |
Checks if the folder exists or can be created or writable. |
|
uploadCheckEmpty ( object &$model, array $data ) : boolean |
Checks if the filename is not empty. |
|
uploadCheckFieldName ( object &$model, array $data ) : boolean |
Checks if the field was declared in the MeioUpload Behavior setup |
|
uploadCheckHttpPost ( object &$model, array $data ) : boolean |
Checks if the file is uploaded via HTTP POST |
|
uploadCheckInvalidExt ( object &$model, array $data ) : boolean |
Checks if the file has an allowed extension. |
|
uploadCheckInvalidMime ( object &$model, array $data ) : boolean |
Checks if the file is of an allowed mime-type. |
|
uploadCheckMaxHeight ( object &$model, array $data ) : boolean |
Checks if the max height is allowed |
|
uploadCheckMaxSize ( object &$model, array $data ) : boolean |
Checks if the file isn't bigger then the max file size option. |
|
uploadCheckMaxWidth ( object &$model, array $data ) : boolean |
Checks if the max width is allowed |
|
uploadCheckMinHeight ( object &$model, array $data ) : boolean |
Checks if the min height is allowed |
|
uploadCheckMinWidth ( object &$model, array $data ) : boolean |
Checks if the min width is allowed |
|
uploadCheckUploadError ( object &$model, array $data ) : boolean |
Checks if ocurred erros in the upload. |
|