1
0
This repository has been archived on 2021-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
gallery3-contrib/client/example.php

37 lines
810 B
PHP
Raw Normal View History

<?
include("Gallery3.php");
$SITE_URL = "http://example.com/gallery3";
$USER = "admin";
$PASSWORD = "admin";
if (file_exists("local_config.php")) {
include("local_config.php");
}
// Connect to our Gallery
$gallery3 = Gallery3::connect($SITE_URL, $USER, $PASSWORD);
$root = $gallery3->get("gallery");
// Create a new album
$album = $root->create_album()
->set_value("name", "Sample Album")
->set_value("title", "This is my Sample Album")
->save();
// Upload a new photo
$photo = $album->create_photo()
->set_value("name", "Sample Photo")
->set_value("title", "Sample Photo")
->set_file("/tmp/foo.jpg")
->save();
// Look up the album and modify it.
$album = $root->get("Sample-Album")
->set_value("title", "This is my title")
->save();
// Now delete the album
$album->delete();
?>