views:

47

answers:

0

Hi There,

I am working with the API from flickr trying to get my photosets into my site, my problem is I am wanting to only show the primary image for each set but current it is showing all the images from each of my sets. Can anyone see where I am going wrong?

<?php
    $f = new phpFlickr(FLICKR_API_KEY);
    $f->enablecache("fs", $_SERVER['DOCUMENT_ROOT']. '/../system/cache');
    $result = $f->people_findByusername(FLICKR_USERNAME);
    $user = $result['id'];
    $photosets = $f->photosets_getList($user);
    $count = 1;
    foreach ($photosets['photoset'] as $ph_set): 
    ?>
      <li>
        <h2>Images</h2>
        <h2>Videos</h2>
      <?php $photoset_id = $ph_set['id'];
      $photos = $f->photosets_getPhotos($photoset_id);
      foreach ($photos['photoset']['photo'] as $photo): ?>
            <a rel="lightbox[album<?=$count;?>]" href="<?= $f->buildPhotoURL($photo, 'medium') ?>" title="<?= $photo['title'] ?>">
            <img src="<?= $f->buildPhotoURL($photo, 'rectangle') ?>" alt="<?= $photo['title'] ?>" width="210" height="160" title="<?= $photo['title'] ?>" />
            <h3><?=$ph_set['title']?></h3>
            <p><?=$ph_set['description'];?></p>
            </a>
      <?php endforeach; ?>
      </li>
    <?php $count++; ?>
    <?php endforeach; ?>