flickr api advice

Posted by sico87 on Stack Overflow See other posts from Stack Overflow or by sico87
Published on 2010-04-01T09:32:06Z Indexed on 2010/04/01 9:33 UTC
Read the original article Hit count: 473

Filed under:
|
|
|
|

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; ?>

© Stack Overflow or respective owner

Related posts about api

Related posts about flickr-api