} //Setup stat variables $categoriesAdded = 0; $albumsAdded = 0; $filesAdded = 0; $filesReplaced = 0; $filesMDUpdated = 0; $filesSkipped = 0; //Begin processing things echo "Determining file structure..."; $structure = get_local_structure($argv[1]); echo "done\n"; try { echo "Connecting to SmugMug..."; $smug = new phpSmug("APIKey={$apiKey}", "AppName={$appInfo}", "APIVer={$apiVersion}"); $smug->login("EmailAddress={$username}", "Password={$password}"); echo "done\n"; echo "Fetching category list from server..."; $categories = $smug->categories_get(); echo "done\n"; echo "Fetching album list from server..."; $serverAlbums = $smug->albums_get("Heavy=1"); echo "done\n"; foreach ($structure as $category => $albums) { echo "\nCategory: {$category}\n"; //Check to see if the category already exists $serverCat = false; foreach ($categories as $cat) { if ($cat['Name'] == $category) { $serverCat = $cat; break;
* - <API KEY> with one provided by SmugMug: http://www.smugmug.com/hack/apikeys * - <APP NAME/VER (URL)> with your application name, version and URL * - <EMAILADDRESS> with your email address * - <PASSWORD> with your SmugMug password * * The <APP NAME/VER (URL)> is NOT required, but it's encouraged as it will * allow SmugMug diagnose any issues users may have with your application if * they request help on the SmugMug forums. * * You can see this example in action at http://phpsmug.com/examples/ */ require_once "../phpSmug.php"; try { $f = new phpSmug("APIKey=<API KEY>", "AppName=<APP NAME/VER (URL)>"); // Login With EmailAddress and Password $f->login("EmailAddress=<EMAILADDRESS>", "Password=<PASSWORD>"); // Get list of albums $albums = $f->albums_get(); // Get list of images and other useful information $images = $f->images_get("AlbumID={$albums['0']['id']}", "AlbumKey={$albums['0']['Key']}", "Heavy=1"); $images = $f->APIVer == "1.2.2" ? $images['Images'] : $images; // Display the thumbnails and link to the medium image for each image foreach ($images as $image) { echo '<a href="' . $image['MediumURL'] . '"><img src="' . $image['TinyURL'] . '" title="' . $image['Caption'] . '" alt="' . $image['id'] . '" /></a>'; } } catch (Exception $e) { echo "{$e->getMessage()} (Error Code: {$e->getCode()})"; } ?> </div> </body>
* You'll need to replace: * - <API KEY> with one provided by SmugMug: http://www.smugmug.com/hack/apikeys * - <APP NAME/VER (URL)> with your application name, version and URL * - <NICKNAME> with a SmugMug nickname. * * The <APP NAME/VER (URL)> is NOT required, but it's encouraged as it will * allow SmugMug diagnose any issues users may have with your application if * they request help on the SmugMug forums. * * You can see this example in action at http://phpsmug.com/examples/ */ require_once "../phpSmug.php"; try { $f = new phpSmug("APIKey=<API KEY>", "AppName=<APP NAME/VER (URL)>"); // Login Anonymously $f->login(); // Get list of public albums $albums = $f->albums_get('NickName=<NICKNAME>'); // Get list of public images and other useful information $images = $f->images_get("AlbumID={$albums['0']['id']}", "AlbumKey={$albums['0']['Key']}", "Heavy=1"); $images = $f->APIVer == "1.2.2" ? $images['Images'] : $images; // Display the thumbnails and link to the medium image for each image foreach ($images as $image) { echo '<a href="' . $image['MediumURL'] . '"><img src="' . $image['TinyURL'] . '" title="' . $image['Caption'] . '" alt="' . $image['id'] . '" /></a>'; } } catch (Exception $e) { echo "{$e->getMessage()} (Error Code: {$e->getCode()})"; } ?> </div> </body>