include 'embed.php';
GalleryEmbed::init(array('fullInit' => true));
// This is what it looks like in AddComment.inc:
//$itemId = GalleryUtilities::getRequestVariables('itemId');
//This is what I've done that I'm not sure will work ($picId is the g_id from Gallery for the picture I'm adding a comment to:
$itemId = $picId;
list ($ret, $comment) =
GalleryCoreApi::newFactoryInstance('GalleryEntity', 'GalleryComment');
$ret = $comment->create($itemId);
$comment->setCommenterId($old->userId);
$comment->setHost('');
$comment->setSubject('');
$comment->setComment($old->text);
$comment->setDate(time());
$ret = $comment->save();
GalleryEmbed::done();