You can extend Gallery's functionality by writing modules and themes, but you can also call Gallery from your own scripts.
Applications (examples):
Note that we don't want you to reinvent the wheel. If you're looking for a command line client to add items, take a look at List of Other Clients.
The GalleryEmbed API is not only handy to integrate Gallery into other web applications, it's also useful to write command line scripts:
<?php
/* Adjust the path to point to your gallery2 folder */
require_once('../gallery2/embed.php');
/*
* Initialize G2 (includes all necessary classes,
* puts G2 into a state ready to process your calls)
*/
$ret = GalleryEmbed::init(array('fullInit' => true));
check($ret);
/* Here go your G2 API calls */
/*
* At the end, commit the transaction by calling ::done()
* or all changes made above will be rolled back automatically
*/
$ret = GalleryEmbed::done();
check($ret);
function check($ret) {
if ($ret) die($ret->getAsHtml());
}
?>
After the GalleryEmbed::init() call, you can use all of Gallery's APIs (GalleryCoreApi, GalleryModuleApi, ...).