$gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties);
if (!($gallery instanceof Gallery)) return '';
$modx->lexicon->load('gallery:web');
$store = $modx->newObject('galItem');
$store->fromArray(array(
'id' => NULL,
'name' => trim($_POST['title']),
'filename' => intval($_POST['category']).'/',
'description' => trim($_POST['descr']),
'mediatype' => 'image',
'createdon' => strftime('%Y-%m-%d %H:%M:%S'),
'createdby' => intval($_POST['uid']),
'active' => '1',
'watermark_pos' => 'tl'
));
$store->save();