samjudson / flickr-net

Home of the FlickrNet API libary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhotoSearch with dimensions in results

ProNotion opened this issue · comments

I'm trying to determine the aspect ratio of photos returned in a search e.g. portrait or landscape but I can't seem to have much luck getting the data in my search results.

flickr.PhotosSearch(
                new PhotoSearchOptions()
                    {
                        Tags = "mytags",
                        SafeSearch = SafetyLevel.Safe,
                        Extras = PhotoSearchExtras.OriginalDimensions
                    });

Is the only way achieve this by making an additional call for each result to PhotosGetSizes?

To get the original dimension you would need to authentication your call and be the owner of the photos I think, otherwise they are not returned (and will be null on the returned Photo instance).

If you just want to know if a photo is portrait or landscape just use one of the other Url formats, like PhotoSearchExtras.LargeUrl and then compare LargeHeight to LargeWidth to find out if it is wider or taller.

Works perfectly - thanks for the quick response and thanks for a great wrapper around this service!