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

Instantiate a photo using photoid

Topics: User Forum
Sep 16, 2006 at 9:53 AM
I'm new to the Flickr API so sorry if my posts are a bit basic!

Is there a way to instantiate a Photo object using the photoID? Basically I want to display my photosets on a page and want to display the thumbnail of each primary photo associated with the set. I want to access this photo using the PrimaryPhotoID property of the photoset object but can't figure out how to do this other than iterating through all the photos in the set to find a matching id. There don't seem to be any constructors for the photo object or any way to search based on photoid.

Any ideas?

Sep 17, 2006 at 3:19 AM
Try this:

PhotoInfo info = flickr.PhotosGetInfo(set.PrimaryPhotoId);

In PhotoInfo, you should find what you need.
Sep 19, 2006 at 1:42 PM
is there a chance to get a photo object this way?
Sep 21, 2006 at 7:51 AM
I'm missing OriginalURL in PhotoInfo.
Sep 23, 2006 at 11:07 PM
The way I understand the FlickrNet framework is that it's based off what the Flickr API gives back as a response. So when you call the GetPhotoDetails method, Flickr doesn't return the same thing as the GetPhotos method so the objects are different. The framework can normalize the results but that's up to the developers.
Sep 24, 2006 at 9:30 AM
I don't understand why exist Photo class and PhotoInfo. For me, they provide the same kind of information.

When I need to write application, I have problem with these two classes. In last Flickr.NET build, class Photo throws exceptions for some properties (DateTaken,... ). So I start to use PhotoInfo, but it doesn't provide properties like Photo.

Because of exceptions, as programmer I need to write complex code that is using:
- Photo and PhotoCollection to search photos
- use PhotoInfo to get photo details. That slows application.

I think that Flickr.NET has to little bit hide Flickr API and provide more object oriented class hierarchy.

I'm trying to store favorite Photo Id to database. But when user select some favorite photo, my application can't provide original photo due to missing property in PhotoInfo. I can't use PhotoSearch method, it doesn't search by photoid.
Sep 25, 2006 at 1:32 PM
That's exactly the same problem I'm having, except I'm looking for a different property.

Sep 26, 2006 at 3:24 AM
I use the WebUrl property for the link to the flickr page. Not sure if this is what you're looking for.
Sep 27, 2006 at 4:16 PM

Some properties are only returned if you ask for them in the Extras property.

See the simple search options example for how to set the extras field.