This project has moved and is read-only. For the latest updates, please go here.

Return all photos in 1 simple step

Topics: Developer Forum
Jul 25, 2007 at 11:41 PM
How can I go about getting the entire list of photos without having to iterate through collections/pages and addrange to my main collection.

I just simply want to perform this task.

Dim f As Flickr = New Flickr(myKey)
Dim options As PhotoSearchOptions = New PhotoSearchOptions()
options.Tags = txtTags.Text

'not acutal code below but what i need to perform.
for each photo in theEntireCollectionOfSearchResults
myTableAdapter.Add( photo.Title, photo.OriginalURL, photo.UserID, photo.OwnerName)

Basically what I'm attempting to create is sort of a STOCK Photo search where I can search for photos, and if I see an image I want to use, I can click on the image, and it will present me with a dialog where I may send a message to the author requesting written consent/authorization to use the image in whatever project I may have.

To put it simply, how can I do a simple search to get ALL matches in ONE collection in the fewest lines of code possible.

Jul 26, 2007 at 9:42 AM
I believe the maximum number of photos you can return in 1 call is 500, although you'd be best to check the Flickr documentation to confirm that.

There is no way to return more than that in one call. Your best bet it to implement some kind of loop where it is done automatically. (Oh, and note that after about 4000 photos the pages will start to repeat anyway).

Dim entireCollection As New PhotoCollection()
Dim f As New Flickr(myKey)
Dim curPage As Integer = 1
Dim options As New PhotoSearchOptions()
options.Tags = txtTags.text
options.PerPage = 500
options.Page = curPage
Dim photos as Photos = f.PhotosSearch(o)
curPage = curPage + 1
While curPage <= photos.TotalPages
    options.Page = curPage
    photos = f.PhotosSearch(o)
    curPage = curPage + 1