InputImage
extends InputFile
in package
MODE; HEIGHT/WIDTH -STD,MIN,MAX,CUT(100%); RATIO, QUALITY, COLOR, TYPE (jpg,gif,png) copy,resize,crop,fill
Table of Contents
Properties
- $addon : array<int, string>|null
- $allowHtml : bool
- $autoComplete : string|null
- $baseDir : string
- $bindTypes : array<string, int>
- $class : string
- $copy : bool
- $empty : bool
- $error : array<string|int, string>
- $filter : array<string, string>|string|bool
- $id : string|int
- $imgClass : string
- $jsType : string|null
- $magic : bool
- $mark : string
- $maxSize : int
- $method : int
- $mode : string
- $oldValue : string
- $quotes : bool
- $rewrite : bool
- $sanitize : string
- $save : string|bool|null
- $setFile : array<int, array<string, mixed>>
- $setImage : array<int, array<string, mixed>>
- $showForm : bool
- $showTable : bool
- $size : int
- $sizeClass : string
- $table : bool
- $tabSize : int
- $value : mixed|null
- $valueInit : mixed|null
- $dataBind : array<string|int, array<string|int, Input>|Input>
- $editable : bool
- $editModes : array<string, int>
- $file : string
- $fileApi : FileApi
- $fileName : string
- $name : array<string, string>
- $names : array<string, int>
- $path : array<string, Input|string>
- $pathStatic : string
- $primaryImage : array<string, int>
- $rules : array<string|int, Rule>
- $saveModes : array<string|int, int>
- $switch : bool
- $type : string
- $upload : bool
Methods
- __construct() : mixed
- Basic input settings
- __toString() : string
- addBind() : self
- Bind other inputs which interact with current one
- addImage() : self
- mode , img settings , sub-path , name prefixes
- delete() : bool
- Delete file
- duplicate() : void
- Duplicate content from another input via POST/GET
- fileExist() : bool
- getAssetScripts() : array<string, mixed>|null
- Get javascript files
- getBind() : array<string|int, Input>|Input|null
- Get specified input bind-type
- getBinds() : array<string|int, array<string|int, Input>|Input>
- Get bounded inputs
- getClass() : string
- Get input classes
- getExt() : string
- getFile() : string|null
- getFileSize() : int|null
- getForm() : string
- Get full form visualization
- getGlobalInput() : string
- Get input for multi-upload inside form
- getGlobalScript() : string
- Get javascript for multi-upload
- getHide() : string
- Get input for type hidden
- getImageClass() : string
- getInput() : string
- Get <input /> html
- getJMark() : string
- Get javascript input var name
- getLabel() : string
- Get html for <label />
- getName() : string
- Get input name based on place
- getNameImg() : string
- getRule() : Rule|null
- Get selected input rule
- getRules() : array<string|int, Rule>
- Return input rules
- getScript() : string|null
- Javascript code for form visualization
- getScriptTable() : string|null
- getSize() : string
- Gets adequate css class for input size
- getTable() : array{VALUE: string, CLASS?: string, REWRITE?: bool}
- Get input's value for presentation in list/table
- getText() : string
- Get input's value for visualization
- getValue() : string|float|int|null
- Get input raw value
- globalDuplicate() : void
- Split selected values from multi-upload (without javascript)
- injectFileApi() : void
- isDeletable() : bool
- isEmpty() : bool
- Is input empty
- isQuotes() : bool
- Are magic quotes active
- isUploaded() : bool
- isValid() : bool
- Is input valid
- load() : void
- If nothing is set, it will add a basic copy of image
- move() : void
- resetBinds() : void
- Remove bounded inputs
- resetRules() : void
- Remove input rules
- sanitize() : string
- By default, fix possible problems with Windows (file duplicates, spec. chars in names)
- set() : self
- Set input value and set default image if not set
- setAddon() : self
- setFileSize() : self
- setFilter() : self
- setId() : self
- Set form ID
- setMaxLength() : self
- setMime() : self
- setMinLength() : self
- setMode() : self
- Set input work mode
- setName() : self
- Set input descriptions
- setPattern() : self
- setPrimary() : self
- setRequired() : self
- Set required message
- setRule() : self
- Set input rule of selected type
- setSave() : self
- Set input save mode
- setShow() : self
- setValue() : self
- Set input value
- translate() : void
- Translate input and rules descriptions
- update() : array<string, mixed>|string|null
- Get data for storage update from form
- updateTable() : array<string|int, string>|bool
- Get sql request for action from table
- appendAddon() : string
- Add addons to input
- check() : bool
- Check length settings
- getFileName() : string
- Create new file name
- getInpName() : string
- Get input element name
- getInputEmpty() : string
- getInputFull() : string
- getInputPreview() : string
- getMaxLength() : int|null
- getMethod() : array<string|int, string|mixed>
- getPath() : string
- getPost() : mixed
- Get POST/GET data and filter them
- getPostData() : mixed|null
- Get POST/GET raw data
- getType() : string
- getValueForm() : string
- Get value for input
- inputBasic() : string
- Get general part of <input /> tag
- isTransmitted() : bool
- Is (must be) input included in POST/GET
- jErrors() : string
- Get error messages for javascript
- modify() : mixed
- Change value based on input class/type
- modValue() : string|null
- noDbFile() : void
- setBindData() : void
- Inserts new data to connected inputs
- setBindDataValue() : void
- upload() : array<string, string>|null
- wrapInputButton() : string
Properties
$addon
public
array<int, string>|null
$addon
= null
Input prefix or suffix
$allowHtml
public
static bool
$allowHtml
= false
$autoComplete
public
string|null
$autoComplete
= null
Autocomplete attribute
$baseDir
public
static string
$baseDir
= './'
Base directory for scripts
$bindTypes
public
array<string, int>
$bindTypes
= []
Inputs bound to current one
$class
public
string
$class
= 'form-control'
Default input CSS class
$copy
public
bool
$copy
= false
Copy or move uploaded file (used for record duplication)
$empty
public
bool
$empty
= true
Can be empty, default true
$error
public
array<string|int, string>
$error
= []
Error messages
$filter
public
array<string, string>|string|bool
$filter
= false
Filter type and allow in table settings (false / true / text / number / check / option - need getOption() )
$id
public
string|int
$id
ID of form where input is
$imgClass
public
string
$imgClass
$jsType
public
static string|null
$jsType
= 'jInputImage'
$magic
public
static bool
$magic
= true
$mark
public
string
$mark
Input element name and db column
$maxSize
public
static int
$maxSize
= 70
$method
public
static int
$method
= INPUT_POST
Input content method
$mode
public
string
$mode
= 'write'
Edit input type ( write / read / disable / hide / dummy - virtual input )
$oldValue
public
string
$oldValue
Old file from database
$quotes
public
static bool
$quotes
= null
Tags
$rewrite
public
bool
$rewrite
= false
File being uploaded can replace an existing file
$sanitize
public
static string
$sanitize
= 'FULL'
$save
public
string|bool|null
$save
= 'var'
Input storing value mode ( var / const - keep saved value / default - refreshing default value )
$setFile
public
array<int, array<string, mixed>>
$setFile
= []
$setImage
public
array<int, array<string, mixed>>
$setImage
= []
$showForm
public
bool
$showForm
= true
Show preview in form
$showTable
public
bool
$showTable
= true
Show preview in table
$size
public
int
$size
Size of input
$sizeClass
public
static string
$sizeClass
= 'col-md-'
CSS class prefix
$table
public
bool
$table
= true
Show in table, default true
$tabSize
public
static int
$tabSize
= 250
$value
public
mixed|null
$value
= null
Input value
$valueInit
public
mixed|null
$valueInit
Initial value (for save default)
$dataBind
protected
array<string|int, array<string|int, Input>|Input>
$dataBind
= []
Using another input as reference (type=>mark)
$editable
protected
bool
$editable
= true
Can be edited/replaced after save
$editModes
protected
static array<string, int>
$editModes
= ['write' => 1, 'read' => 1, 'disable' => 1, 'hide' => 1, 'dummy' => 1]
Show modes
$file
protected
string
$file
= ''
File rename
$fileApi
protected
FileApi
$fileApi
$fileName
protected
string
$fileName
Original file name
$name
protected
array<string, string>
$name
LABEL name, TABLE name, SCRIPT name, TITLE input description text
$names
protected
static array<string, int>
$names
= ['LABEL' => 1, 'TITLE' => 1, 'TABLE' => 1, 'PLACEHOLDER' => 1, 'SCRIPT' => 1]
$path
protected
array<string, Input|string>
$path
= []
Dynamic part of upload path
$pathStatic
protected
string
$pathStatic
= ''
Static part of upload path
$primaryImage
protected
array<string, int>
$primaryImage
= []
Number of the image to be used for dataBinding, table, form
$rules
protected
array<string|int, Rule>
$rules
= []
Appended rules for input
$saveModes
protected
static array<string|int, int>
$saveModes
= [
'var' => 1,
'const' => 1,
'default' => 1,
0 => 1,
// FALSE
'' => 1,
]
Value modes - allow FALSE and NULL
$switch
protected
bool
$switch
= false
Switch order of static and dynamic part in upload path
$type
protected
static string
$type
= 'text'
$upload
protected
bool
$upload
= false
Uploaded file is ok
Methods
__construct()
Basic input settings
public
__construct(string $mark, mixed $name[, mixed $sets = [] ][, mixed $value = [] ][, mixed $lengths = [] ][, array<string|int, mixed> $filter = [] ]) : mixed
Parameters
- $mark : string
-
Input name
- $name : mixed
-
Label text
- $sets : mixed = []
- $value : mixed = []
- $lengths : mixed = []
- $filter : array<string|int, mixed> = []
-
Allowed extensions
__toString()
public
__toString() : string
Return values
stringaddBind()
Bind other inputs which interact with current one
public
addBind(Input $input[, string|null $type = null ]) : self
Parameters
- $input : Input
- $type : string|null = null
Tags
Return values
selfaddImage()
mode , img settings , sub-path , name prefixes
public
addImage([array<string, mixed> $image = [] ][, array<string, mixed> $file = [] ]) : self
Parameters
- $image : array<string, mixed> = []
- $file : array<string, mixed> = []
Tags
Return values
selfdelete()
Delete file
public
delete([bool $new = true ]) : bool
Parameters
- $new : bool = true
Return values
boolduplicate()
Duplicate content from another input via POST/GET
public
duplicate(int $fromId[, string|null $fromMark = null ]) : void
Parameters
- $fromId : int
- $fromMark : string|null = null
fileExist()
public
fileExist([bool $saved = true ]) : bool
Parameters
- $saved : bool = true
Return values
boolgetAssetScripts()
Get javascript files
public
getAssetScripts(bool $edit) : array<string, mixed>|null
Parameters
- $edit : bool
Return values
array<string, mixed>|nullgetBind()
Get specified input bind-type
public
getBind(string $type) : array<string|int, Input>|Input|null
Parameters
- $type : string
Return values
array<string|int, Input>|Input|nullgetBinds()
Get bounded inputs
public
getBinds() : array<string|int, array<string|int, Input>|Input>
Return values
array<string|int, array<string|int, Input>|Input>getClass()
Get input classes
public
getClass() : string
Return values
stringgetExt()
public
getExt(string $name) : string
Parameters
- $name : string
Return values
stringgetFile()
public
getFile([bool $saved = true ]) : string|null
Parameters
- $saved : bool = true
Return values
string|nullgetFileSize()
public
getFileSize() : int|null
Return values
int|nullgetForm()
Get full form visualization
public
getForm([string|bool $label = true ][, array{0: string, 1?: string|null, 2?: bool}|null $elem = ['p'] ][, string $post = '' ]) : string
Parameters
- $label : string|bool = true
- $elem : array{0: string, 1?: string|null, 2?: bool}|null = ['p']
- $post : string = ''
Return values
stringgetGlobalInput()
Get input for multi-upload inside form
public
getGlobalInput(mixed $parentId, int $type) : string
Parameters
- $parentId : mixed
- $type : int
Return values
stringgetGlobalScript()
Get javascript for multi-upload
public
getGlobalScript(string $jMark) : string
Parameters
- $jMark : string
Return values
stringgetHide()
Get input for type hidden
public
getHide() : string
Return values
stringgetImageClass()
public
static getImageClass() : string
Return values
string —Image
getInput()
Get <input /> html
public
getInput() : string
Return values
stringgetJMark()
Get javascript input var name
public
getJMark() : string
Return values
stringgetLabel()
Get html for <label />
public
getLabel([string|null $class = null ]) : string
Parameters
- $class : string|null = null
Return values
stringgetName()
Get input name based on place
public
getName([string $type = 'TABLE' ]) : string
Parameters
- $type : string = 'TABLE'
Return values
stringgetNameImg()
public
getNameImg(string $value[, int|null $num = null ]) : string
Parameters
- $value : string
- $num : int|null = null
Return values
stringgetRule()
Get selected input rule
public
getRule(string $type) : Rule|null
Parameters
- $type : string
Return values
Rule|nullgetRules()
Return input rules
public
getRules() : array<string|int, Rule>
Return values
array<string|int, Rule>getScript()
Javascript code for form visualization
public
getScript(string $jForm[, array<string, mixed> $base = [] ][, array<string, mixed> $para = [] ]) : string|null
Parameters
- $jForm : string
- $base : array<string, mixed> = []
- $para : array<string, mixed> = []
Return values
string|nullgetScriptTable()
public
getScriptTable() : string|null
Return values
string|nullgetSize()
Gets adequate css class for input size
public
getSize([int $crop = 0 ]) : string
Parameters
- $crop : int = 0
Return values
stringgetTable()
Get input's value for presentation in list/table
public
getTable() : array{VALUE: string, CLASS?: string, REWRITE?: bool}
Return values
array{VALUE: string, CLASS?: string, REWRITE?: bool}getText()
Get input's value for visualization
public
getText() : string
Return values
stringgetValue()
Get input raw value
public
getValue() : string|float|int|null
Return values
string|float|int|nullglobalDuplicate()
Split selected values from multi-upload (without javascript)
public
globalDuplicate(int $parentId, int $type, int $ident) : void
Parameters
- $parentId : int
- $type : int
- $ident : int
injectFileApi()
public
injectFileApi(FileApi $api) : void
Parameters
- $api : FileApi
isDeletable()
public
isDeletable() : bool
Return values
boolisEmpty()
Is input empty
public
isEmpty() : bool
Return values
boolisQuotes()
Are magic quotes active
public
isQuotes() : bool
Tags
Return values
boolisUploaded()
public
isUploaded() : bool
Return values
boolisValid()
Is input valid
public
isValid() : bool
Return values
boolload()
If nothing is set, it will add a basic copy of image
public
load() : void
move()
public
move([string $from = '' ][, string $to = '' ]) : void
Parameters
- $from : string = ''
- $to : string = ''
resetBinds()
Remove bounded inputs
public
resetBinds() : void
resetRules()
Remove input rules
public
resetRules() : void
sanitize()
By default, fix possible problems with Windows (file duplicates, spec. chars in names)
public
static sanitize(string $value) : string
Parameters
- $value : string
Return values
stringset()
Set input value and set default image if not set
public
set(array<string, mixed> $array[, bool $force = false ]) : self
Parameters
- $array : array<string, mixed>
- $force : bool = false
Return values
selfsetAddon()
public
setAddon(array<int, string>|string $addon) : self
Parameters
- $addon : array<int, string>|string
Return values
selfsetFileSize()
public
setFileSize(float $size[, string|null $msg = null ]) : self
Parameters
- $size : float
-
Size in megabytes
- $msg : string|null = null
Return values
selfsetFilter()
public
setFilter(array<string|int, string> $types[, string|null $msg = null ]) : self
Parameters
- $types : array<string|int, string>
- $msg : string|null = null
Return values
selfsetId()
Set form ID
public
setId(string|int $id) : self
Parameters
- $id : string|int
Return values
selfsetMaxLength()
public
setMaxLength(int $val[, string|null $msg = null ]) : self
Parameters
- $val : int
- $msg : string|null = null
Return values
selfsetMime()
public
setMime(string $mime[, string $msg = null ]) : self
Parameters
- $mime : string
- $msg : string = null
Return values
selfsetMinLength()
public
setMinLength(int $val[, string|null $msg = null ]) : self
Parameters
- $val : int
- $msg : string|null = null
Return values
selfsetMode()
Set input work mode
public
setMode(string $mode) : self
Parameters
- $mode : string
Tags
Return values
selfsetName()
Set input descriptions
public
setName(array<string, string>|string $name[, string|null $type = null ]) : self
Parameters
- $name : array<string, string>|string
- $type : string|null = null
Tags
Return values
selfsetPattern()
public
setPattern(string $pattern[, string|null $msg = null ]) : self
Parameters
- $pattern : string
- $msg : string|null = null
Return values
selfsetPrimary()
public
setPrimary(array<string, int>|int $ids) : self
Parameters
- $ids : array<string, int>|int
Tags
Return values
selfsetRequired()
Set required message
public
setRequired([bool $require = true ][, string|null $msg = null ]) : self
Parameters
- $require : bool = true
- $msg : string|null = null
Return values
selfsetRule()
Set input rule of selected type
public
setRule(string $type, Rule $rule) : self
Parameters
- $type : string
- $rule : Rule
Return values
selfsetSave()
Set input save mode
public
setSave(string|bool|null $mode) : self
Parameters
- $mode : string|bool|null
Tags
Return values
selfsetShow()
public
setShow(array<string, bool>|bool $show) : self
Parameters
- $show : array<string, bool>|bool
Return values
selfsetValue()
Set input value
public
setValue(mixed $val) : self
Parameters
- $val : mixed
Return values
selftranslate()
Translate input and rules descriptions
public
translate(Translator $tr) : void
Parameters
- $tr : Translator
update()
Get data for storage update from form
public
update() : array<string, mixed>|string|null
Return values
array<string, mixed>|string|nullupdateTable()
Get sql request for action from table
public
updateTable(array<string, mixed>|string $action) : array<string|int, string>|bool
Parameters
- $action : array<string, mixed>|string
Tags
Return values
array<string|int, string>|boolappendAddon()
Add addons to input
protected
appendAddon(string $inp) : string
Parameters
- $inp : string
Return values
stringcheck()
Check length settings
protected
check(array<string, int> $array) : bool
Parameters
- $array : array<string, int>
Return values
boolgetFileName()
Create new file name
protected
getFileName(string|null $value[, string|null $file = null ][, bool $cut = true ]) : string
Parameters
- $value : string|null
- $file : string|null = null
- $cut : bool = true
Return values
stringgetInpName()
Get input element name
protected
getInpName() : string
Return values
stringgetInputEmpty()
protected
getInputEmpty() : string
Return values
stringgetInputFull()
protected
getInputFull(string $path, string $file) : string
Parameters
- $path : string
- $file : string
Return values
stringgetInputPreview()
protected
getInputPreview(string $path, string $file) : string
Parameters
- $path : string
- $file : string
Return values
stringgetMaxLength()
protected
getMaxLength() : int|null
Return values
int|nullgetMethod()
protected
final static & getMethod() : array<string|int, string|mixed>
Return values
array<string|int, string|mixed>getPath()
protected
getPath(string $type[, string|null $path = null ]) : string
Parameters
- $type : string
- $path : string|null = null
Return values
stringgetPost()
Get POST/GET data and filter them
protected
getPost() : mixed
Tags
getPostData()
Get POST/GET raw data
protected
getPostData() : mixed|null
Return values
mixed|nullgetType()
protected
getType() : string
Return values
stringgetValueForm()
Get value for input
protected
getValueForm() : string
Return values
stringinputBasic()
Get general part of <input /> tag
protected
inputBasic([string|null $append = null ]) : string
Parameters
- $append : string|null = null
Return values
stringisTransmitted()
Is (must be) input included in POST/GET
protected
isTransmitted() : bool
Return values
booljErrors()
Get error messages for javascript
protected
final jErrors(string $jInput) : string
Parameters
- $jInput : string
Return values
stringmodify()
Change value based on input class/type
protected
modify(mixed $val) : mixed
Parameters
- $val : mixed
modValue()
protected
modValue(string|null $value) : string|null
Parameters
- $value : string|null
Return values
string|nullnoDbFile()
protected
noDbFile() : void
setBindData()
Inserts new data to connected inputs
protected
setBindData([array<string, mixed> $dataList = [] ][, bool $forced = false ]) : void
Parameters
- $dataList : array<string, mixed> = []
- $forced : bool = false
setBindDataValue()
protected
setBindDataValue(Input $inp, mixed $val[, bool $forced = false ]) : void
Parameters
- $inp : Input
- $val : mixed
- $forced : bool = false
upload()
protected
upload(string $value) : array<string, string>|null
Parameters
- $value : string
Return values
array<string, string>|nullwrapInputButton()
protected
wrapInputButton(string $input) : string
Parameters
- $input : string