Download random image from flickr using keyword

I noticed this code when I was playing with a shallow bass player showing it to a friend that he has a built in option to load image from flicker based on keyword

I was wondering if anyone has an example in C # for this so I can figure out how to use the api.

0


source to share


2 answers


private void button1_Click(object sender, EventArgs e)
{
    string apikey = "3f8554b23a5we2fe2c7asdg80agnkdm9cedag415f34d9fb";
    Flickr F = new Flickr(apikey);


    // Example 2
    PhotoSearchOptions searchOptions = new PhotoSearchOptions();
    searchOptions.Tags = textBox1.Text;
    searchOptions.PerPage = 100;
    Photos microsoftPhotos = F.PhotosSearch(searchOptions);

    // Example 3
    searchOptions.Page = 2;
    Photos microsoftPhotos2 = F.PhotosSearch(searchOptions);
    searchOptions.Page = 3;
    Photos microsoftPhotos3 = F.PhotosSearch(searchOptions);

    // Eample 4
    PhotoCollection allPhotos = microsoftPhotos.PhotoCollection;
    allPhotos.AddRange(microsoftPhotos2.PhotoCollection);
    allPhotos.AddRange(microsoftPhotos3.PhotoCollection);


    progressBar1.Maximum = allPhotos.Count;
    progressBar1.Value = 0;


    foreach (Photo p in allPhotos)
    {
        pictureBox1.Image = Image.FromStream(F.DownloadPicture(p.MediumUrl));

        this.Refresh();

        progressBar1.Value++;
    }
}

      



+2


source


I've never messed with the Flickr API, but here is the link I found that seems to be very helpful:



http://blogs.msdn.com/coding4fun/archive/2006/11/22/1126978.aspx

+2


source







All Articles