how to get large pictures from photo album via facebook graph api

Posted by Nav on Stack Overflow See other posts from Stack Overflow or by Nav
Published on 2012-09-02T09:33:49Z Indexed on 2012/09/02 9:38 UTC
Read the original article Hit count: 202

I am currently using the following code to retrieve all the photos from a user profile

                    FB.api('/me/albums?fields=id,name', function(response) {
                        //console.log(response.data.length);
                        for (var i = 0; i < response.data.length; i++) {
                            var album = response.data[i];

                            FB.api('/' + album.id + '/photos', function(photos) {
                                if (photos && photos.data && photos.data.length) {
                                    for (var j = 0; j < photos.data.length; j++) {
                                        var photo = photos.data[j];
                                        // photo.picture contain the link to picture
                                        var image = document.createElement('img');
                                        image.src = photo.picture;
                                        document.body.appendChild(image);
                                        image.className = "border";

                                        image.onclick = function() {
                                            //this.parentNode.removeChild(this);
                                            document.getElementById(info.id).src = this.src;
                                            document.getElementById(info.id).style.width = "220px";
                                            document.getElementById(info.id).style.height = "126px";
                                        };
                                    }
                                }
                            });

                        }
                    });

but, the photos that it returns are of poor quality and are basically like thumbnails.How to retrieve larger photos from the albums.

Generally for profile picture I use ?type=large which returns a decent profile image

but the type=large is not working in the case of photos from photo albums and also is there a way to get the photos in zip format from facebook once I specify the photo url as I want users to be able to download the photos.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about facebook