By: Multimedia XP
2020-03-24


KAS Documentation / KAS Documentation /

Form fields - Drop Zone

By: Multimedia XP
2020-03-24

Form fields - Drop Zone
This version overwrites any older version, if you need to fix an older version simply replace for this one

The Drop Zone has 3 paramters, 'DropZone', the Label to show in the form and an array with parameters.

 

addField('DropZone','Label',$upload_params);

 

By default, KAS is pre-configured to upload images, therefore the minimum required parameters are the following, for add sections (ex. Add Article), you must have the parameter load = 'false' (string) or Drop Zone will try to fetch the value from the database.

 

$upload_params = array(
  'folder' => '/images',
  'col' => 'img_url',
  'file_name'=> 'aboutImage',
  'thumb_col' => 'thumb_url'
);

 

The previous example will overwrite the image saved, create a thumbnail, show a preview, give the delete option, and set a max_file_size of 20MB, a default with of 1920px and a thumb with of 400px

Drop Zone is very customizable and all the paramteres available are the following,

*load adds the value of the database to the value of the fields,

*all booleans need to be written as strings:


$upload_params = array(
  'load' => 'true', //or false if first time upload (add)
  'overwrite' => 'true',
  'preview' => 'true',
  'delete_op' => 'true',
  'action' => 'image', //or file (PDF, CSV, etc)
  'extensions'=> 'jpg,png,gif',
  'mimes' => 'image/jpeg,image/png,image/gif',
  'folder' => '/images',
  'col' => 'img_url',
  'thumb' => 'true',
  'thumb_col' => 'thumb_url',
  'file_name'=> 'aboutImage',
  'max_size' => '20',
  'img_width' => '1920',
  'thumb_width'=> '400'
);

Comments