Drag and Drop Field - option type S

Add a Drag and Drop Field in Table Views

When using drag and drop image fields in table we use the option type "S", S stands for Single Image Drop, as this allows to drop only one image per row.

When creating the section make sure to add the option type S

$Blog->setOption("VIEW ARTICLES,VER ARTICULOS,VOIR ARTICLES","aside","4","VPSLB",true);

The option type S will make the $options['drag_drop'] variable = true and will let us use the following variables in our table view, these are the default values:

//declared in header when option type S exists
//$options['drag_drop'] = true 

$dragAndDrop= [
	db_field = 'img_url', # Column in DB
	action => 'image', # Ajax action
	upload_target => '/images', # target folder
	new_file_name => 'image', # default new file name when name_from_db_col is not available
	name_from_db_col => "title_$mainLang", # column name from the database from where the image name is taken
	max_file_size => 25600, # in kb (25Mb)
	overwrite => true, # overwrite the image file and re generate the image name (will erase old file, images are never increased in size only reduced)
	width => 1920, # Any image uploaded bigger than this size will be resized down to this value in px
 	add_thumbs => false, # will automatically create a thumbnail
	thumb_db_field => 'thumb_url', # Column in DB for the thumbnail
	thumb_upload_target => null, # target folder the thumbnail, if left null the default is "upload_target"/thumbs
	thumb_width => 600, # final with of the thumbnail (images are never increased in size only reduced)
	extensions => 'jpg,png,gif,svg', # file extensions
	allowed_files => "image/jpeg,image/png,image/gif,image/svg+xml"; # mime types			
];

 

The minimum recommended required parameters are: 

# Drag and Drop
# option type "S" variables (single upload)

$dragAndDrop = [
	db_field = 'img_url', # Column in DB
	upload_target => '/images/products',
	name_from_db_col => "title_$mainLang", # column name from the database from where the image name is taken
	add_thumbs => true, # will automatically create a thumbnail
	thumb_db_field => 'thumb_url', # Column in DB for the thumbnail			
];