Not signed in (Sign In)
Welcome, Guest

Did you know that there is a whole world of functionality you're not seeing? If you have an account, sign in now.

If you don't have an account, apply for one now.

Bottom of Page
Help: photosets_getPhotos not paginating
  1.  
1 to 3 of 3
Nov 4th 2006
I'm having issues.

For the most part, I've got things figured out. But when I'm trying to get just a subset of my photosets - page1, 40 pictures, etc - it seems to be ignoring my API parameters. This is vexing.

Whis is what I'm trying to do:
photosets_getPhotos($setID, NULL, NULL, 30, $page);

where setID is the photoset ID, and page is the page number.

Every time it returns every single photo in the set.

I feel I'm missing something obvious.
Nov 4th 2006 edited
This is a bug with phpFlickr. Check out the Problem with optional argument on flickr.photosets.getPhotos call thread for a solution.
-Chasen
Aug 7th 2008
here is the code

require_once("inc/config.php");
if(!empty($_GET))
{
if(($_GET['setId'] != NULL) || ($_GET['setId'] != " "))
{
$photos = "";
$page = $_GET['page'] ? $_GET['page'] : 1;
$set = $_GET['setId'];
$size = $_GET['size'] ? $_GET['size'] : "Square";
$count = $_GET['count'] ? $_GET['count'] : 4;
$prev = $page - 1;
$next = $page + 1;
$prevLink = "";
$nextLink = "";

if ($set) { // show photos from this set
$photoSet = $f->photosets_getInfo($set);
$title = "sets // " . htmlspecialchars($photoSet['title'], ENT_QUOTES);
$photos = $f->photosets_getPhotos($set, "original_format,date_taken,date_upload", "", $count, $page);
$prevLink = "setId=" . $set . "&page=" . $prev . "&count=" . $count . "&size=" . $size;
$nextLink = "setId=" . $set. "&page=" . $next . "&count=" . $count . "&size=" . $size;
}


foreach($photos['photo'] as $photo)
{
$datePosted = date("F j, Y", $photo['dateupload']);
$photo_thumbs .=
"<a href='" . $f->buildPhotoURL($photo, "") . "'>" .
"<img class='thumbnail' src='" . $f->buildPhotoURL($photo, $size) . "' title='" . htmlspecialchars($photo['title'], ENT_QUOTES) . "::" . $datePosted . "' alt=''/> " .
"</a>";
$photo_thumbs .="&nbsp;&nbsp;&nbsp";
}
?>
<div>
<span><?php echo $title; ?></span>
<span>
<?php if (0 < $prev) { ?>
<a href='photo_sets.php?<?php echo $prevLink; ?>'>prev </a>
<?php } ?>
<?php if ($next <= $photos['pages']) { ?>
<a href='photo_sets.php?<?php echo $nextLink; ?>'>next</a>
<?php } ?>
</span>
</div>

<div>
<div>
<?php echo $photo_thumbs; ?>
</div>
</div>
<?
}

}
else
{
if (!$config_flickrUserId)
{
die("config_flickrUserId must be set in config.php to view sets.");
}

$sets = $f->photosets_getList($config_flickrUserId);
$photoSetData = "";

foreach ($sets['photoset'] as $set) {
$info = $f->photos_getInfo($set['primary']);
$photoSetData .=
"<a href='photo_sets.php?setId=" . $set['id'] . "' alt='' title='" . htmlspecialchars($set['description'], ENT_QUOTES)
. "'>" .
"<img class='thumbnail' src='" . $f->buildPhotoURL($info, "Square") . "' alt='' title='" .
htmlspecialchars($set['title'], ENT_QUOTES) . "::" . htmlspecialchars($set['description'], ENT_QUOTES) . "'/>" .
"</a>";
}
echo $photoSetData;
}
  1.  
1 to 3 of 3
Top of PageBack to discussions