Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:33:44+00:00 2026-06-01T13:33:44+00:00

Is that real to pull only one (first or last, no matter) photo from

  • 0

Is that real to pull only one (first or last, no matter) photo from each album in the Facebook JavaScript SDK?

I’m tried to make this with a cycle for each album, but I think it is not good idea to do requests to Facebook for every album, especially if user has 50 or more albums. I need it to display the thumbnail next to each album.

What I tried:

FB.api('/me/albums?access_token='+response.authResponse.accessToken,function(response){
    if(response.error){
        alert(response.error);
    }
    else {
        var albums = new Array();
        albums = response.data;
        var albumsCount = albums.length;
        var albumsString = "";
        var i = 0;
        for(i = 0; i<albumsCount;i++){

            //Here is that bad idea with requests in every cycle
            FB.api('/'+albums[i].id+'/photos?access_token='+FB.getAuthResponse().accessToken,function(response){
                if(response.error) {
                    alert(response.error);
                }
                else {
                    var photo=response.data;
                    var photoHere="<img src='"+photo[i].picture+"'>";
                }
            });
            //End of bad idea

            albumsString+="<a href='#' return false'>"+albums[i].name+"</a><br/>";
        }
        var toHTML="List of your albums: "+albumString+"<br/>";
        document.getElementById("resultAlbums").innerHTML=toHTML;
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:33:46+00:00Added an answer on June 1, 2026 at 1:33 pm

    It seems like you’re looking for the cover photo of each album. One trick I found was to use the /picture connection from an album id.

    So, https://graph.facebook.com/%5Balbum_id%5D/picture will redirect to the cover image for that album.

    That’ll remove the need for the inner, slow loop.

    You’ll need to authenticate by adding ?access_token=.. to the url to show covers of non-public albums.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a web application that has a real-time feed (similar to Facebook's
I have some code that is using reflection to pull property values from an
The following query works properly to pull company names from one table into jquery
I have a large set of real-world text that I need to pull words
It seems that in IE9, using jquery .load will pull data from the browsers
I've never really written a real Chrome extension. I did one that was just
We have multiple subscriptions (merge pull) at our subscriber for only 1 real subscription.
In this xkcd comic : they mention that real programmers use cat . Well,
I have a program that receives real time data on 1000 topics. It receives
I am working on a program that extracts real time quote for 900+ stocks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.