Getting the size of a Photo

19 views
Skip to first unread message

Paul Bourke

unread,
Jun 4, 2012, 2:38:09 PM6/4/12
to flickrj...@googlegroups.com
I'm using the following basic code from flickrj-android-sample-android to fetch a list of my photos:

        Flickr f = FlickrHelper.getInstance().getFlickrAuthed(token.getOauthToken(), token.getOauthTokenSecret());
        Set<String> extras = new HashSet<String>();
        extras.add("url_s");
        extras.add("url_l");
        extras.add("views");
        User user = arg0[0].getUser();
        try {
            return f.getPeopleInterface().getPhotos(user.getId(), extras, 20, 1);
        } catch (Exception e) {
            e.printStackTrace();
        }

This works fine, but I'd like to know the dimensions of each photo before displaying them.  I would have thought something like this should work:

        for (Photo p : photos) {
            int rowWidth = p.getSmallSize().getWidth();
        }

But this returns null.  If I add 'extras.add("o_dims")' to the request above, it doesn't return null but 0.

Is there a way to get this info from a Photo object without having to make a separate request to something like PhotosInterface.getSizes() ?

Thanks!

Yang Yu

unread,
Jun 6, 2012, 7:29:24 AM6/6/12
to flickrj...@googlegroups.com
Hi Paul Bourke:
  Thanks for interesting in my project.

  Actually all the photo sizes are predefined by Flickr, and you can find all possible available sizes via:  http://www.flickr.com/services/api/flickr.photos.getSizes.html 
--


Reply all
Reply to author
Forward
0 new messages