* - <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> </html>
break; } } //Create the album if it doesn't exist if (!$serverAlbum) { echo "\t\tCreating album..."; $serverAlbum = $smug->albums_create("Title={$album}", "CategoryID={$serverCat['id']}"); $serverAlbum = $smug->albums_getInfo("AlbumID={$serverAlbum['id']}", "AlbumKey={$serverAlbum['Key']}"); echo "done\n"; $albumsCreated++; } //Download image information for the album if it is available $images = array(); if ($serverAlbum['ImageCount'] > 0) { echo "\t\tDownloading image information from album..."; $albumImages = $smug->images_get("AlbumID={$serverAlbum['id']}", "AlbumKey={$serverAlbum['Key']}", "Heavy=1"); $albumImages = $smug->APIVer == "1.2.2" ? $albumImages['Images'] : $albumImages; if (!empty($albumImages)) { foreach ($albumImages as $image) { $images[$image['FileName']] = $image; } } echo "done\n"; } else { echo "\t\tAlbum is currently empty\n"; } //Start dealing with files echo "\t\tPreparing files..."; $uploads = array(); foreach ($files as $file) { $uploads[] = prepare_file($file);