|
56 | 56 | $f = new phpZenfolio("AppName={$appname}"); |
57 | 57 | // Get list of recent galleries and collections |
58 | 58 | $h = $f->LoadGroupHierarchy($username); |
59 | | - // Get all the pictures in the first element |
60 | | - $pictures = $f->LoadPhotoSetPhotos($h['Elements'][0]['Id'], 0, 100 ); |
61 | | - // Display the 60x60 cropped thumbnails and link to the photo page for each. |
62 | | - foreach ($pictures as $pic) { |
63 | | - echo '<a href="',$pic['PageUrl'],'"><img src="',phpZenfolio::imageUrl($pic, 1),'" title="',$pic['Title'],'" alt="',$pic['Id'],'" /></a>'; |
64 | | - } |
| 59 | + // Now traverse the tree and locate the first public gallery and display it's first 100 photos |
| 60 | + array_walk($h['Elements'], 'displayImgs', $f); |
65 | 61 | } |
66 | 62 | catch (Exception $e) { |
67 | 63 | echo "{$e->getMessage()} (Error Code: {$e->getCode()})"; |
68 | 64 | } |
| 65 | + |
| 66 | +function displayImgs($element, $key, $f) { |
| 67 | + if ( $element['$type'] == 'Group' ) { |
| 68 | + array_walk($element['Elements'], 'displayImgs', $f); |
| 69 | + } else { |
| 70 | + if ( $element['PhotoCount'] > 0 ) { |
| 71 | + $pictures = $f->LoadPhotoSetPhotos($element['Id'], 0, 100 ); |
| 72 | + // Display the 60x60 cropped thumbnails and link to the photo page for each. |
| 73 | + foreach ($pictures as $pic) { |
| 74 | + echo '<a href="',$pic['PageUrl'],'"><img src="',phpZenfolio::imageUrl($pic, 1),'" title="',$pic['Title'],'" alt="',$pic['Id'],'" /></a>'; |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | +} |
69 | 79 | ?> |
70 | 80 | </body> |
71 | 81 | </html> |
0 commit comments