G2 Utility from PHP CLI

GuruBob
GuruBob's picture

Joined: 2003-03-31
Posts: 10
Posted: Mon, 2005-12-26 14:15

Hi All,

I am wanting to write (and release ;) ) a utility that allows me to import and export images from PHP running in commandline mode. I've had a look through the code and documentation but the examples given are only for embedding G2 inside a CMS (for example).

Can anyone tell me whether G2 in PHP/CLI works, and if so give me a head start with creating such a utility.

Basically I'd like to do something like this:

$image = new GalleryImage();
$image->BinaryContent = file_get_contents('image.jpg');
$image->MimeType = 'image/jpeg';
$gallery->InsertIntoAlbum('My Pictures',$image);

(that's not 'real' code, but it gives an idea of my intentions.

Any help appreciated.

Cheers,

- Bob -

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Mon, 2005-12-26 15:36

Once the XML-RPC module is finished, that will be the ideal way to interact with a Gallery 2 inctall via the command line. Code to interact with it will look like this:

$msg = new XML_RPC_Message('deleteEntityById', array(new XML_RPC_Value($authtoken, 'string'), new XML_RPC_Value($newAlbumId, 'int')));
$result = $client->send($msg);
 
GuruBob
GuruBob's picture

Joined: 2003-03-31
Posts: 10
Posted: Mon, 2005-12-26 15:51

Hey funky :) I know it's a tough question to answer but is there an ETA for this?

Cheers!

- Bob -

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Mon, 2005-12-26 16:39

Should be a couple of months or less. I think the target for its release is Gallery 2.2. If you want to play around with it some, there is a module thats mostly working on http://sf.net/projects/gallery-contrib/ named remoteprotocol, but we aren't making any promises about what will and won't change before it is finished :)

 
GuruBob
GuruBob's picture

Joined: 2003-03-31
Posts: 10
Posted: Mon, 2005-12-26 23:12

Thanks for the link, I'll have a play and wait in earnest for 2.2!