You'll need to work with gallery item table object. Specifically the below class.
/components/com_comprofiler/plugin/user/plug_cbgallery/library/Table/ItemTable.php
Example of how to initialize such object.
Code:
$item = new \CB\Plugin\Gallery\Table\ItemTable();
Review the class provided above for further usage information. It can process the upload automatically in ->store if you set the input data into _input and the files data into _files. Example as follows.
Code:
$item = new \CB\Plugin\Gallery\Table\ItemTable();
$item->set( '_input', $input );
$item->set( '_files', $input->getNamespaceRegistry( 'files' ) );
That would work with a standard HTML form. So you'll need to adjust it however necessary based off your usage. _files is specifically the PHP global $_FILES.