Displaying Album Thumbnail

illiterategeniusilliterategenius BeijingRegistered Users Posts: 1 Beginner grinner
Hello,

I am fairly new to API development in general, and even newer to SmugMug's API, so thank you in advance for your patience/understanding. If you catch yourself thinking, "does this fool really not know how to do xxxxx," the answer is more than likely "no, no he doesn't." And, honestly, I am really not that good at PHP. Sorry, this is what you are dealing with.

I started last week and I am just trying to understand the structure of SmugMug's API. Using PHP, I am just trying to display a list of albums in our account. I got that, but I can't figure out the path for getting the album's thumbnail. On another page that is returning the images in one album, get the thumbnails using:

$images = $client->get($albums->Album[0]->Uris->AlbumImages
foreach ($images->AlbumImage as $image) {
printf('<a href="%s"><img src="%s" title="%s" alt="%s" width="150" height="150" /></a>', $image->WebUri, $client->signResource($image->ThumbnailUrl), $image->Title, $image->ImageKey);
}

I've tried to apply this same logic to retrieve the Album's thumbnail, but to no avail. Whatever I try, I get errors (not an object, doesn't exist, etc., etc.). This is where I quit

$albums = $client->get("user/{$username}!albums");
$node = $client->get("highlight/node/{$album->NodeID}");

foreach ($albums->Album as $album) {
if($x<=2) {
$node = $client->get("highlight/node/{$album->NodeID}");
$node = json_decode( json_encode($node));
$Output=$Output."<a href=" . $album->WebUri . "><img src=". $client->signResource($node->HighlightImageUri->ThumbnailUrl) . " title=" . $album->Name . " alt=" . $album->Name . " width=" . "150" . " height=" . "150" . " /></a>" . "\n";

I have tried 25+ different iterations of the img src ($album...; $node...; with the signResource; without it; etc., etc.)

Any help would be appreciated; I am hoping that figuring this out will help me get a better grasp of the API's structure and I will be able to do more on my own.

Thanks,
Matt
Sign In or Register to comment.