Asked  10 Months ago    Answers:  5   Viewed   4 times

I can retrieve facebook cover source and offset_y from graph api for example -

I get this -

"cover": {
      "cover_id": "10151356812150381",
      "source": "",
      "offset_y": 54

But when i look at the actual facebook page for this, i see the top offset is -135px. How is that calculated from 54?

I want to display someones cover photo on my website, with the same offset as facebook. So I am basically doing -

<div class="ed-cover">
            <img src=""/>


.ed .ed-cover

.ed .ed-cover img

JS -

FB.api(artist, function (data) {
                        $('.ed-cover img').attr('src', data.cover.source).css("top", -1 * data.cover.offset_y);

But the CSS offset here for the "top" property is incorrect as i get back 54 and the real offset is -135px;



Yes i actually found the answer myself. The offset that facebook sends is in percentage!

The following worked perfectly -

    FB.api(artist, function (data) {
                            $('.ed-cover img').attr('src', data.cover.source)
.css("top", (-1 * data.cover.offset_y) + '%');
Wednesday, August 4, 2021

You need to retrieve all the albums and then get all the photos. This can be easily done by using FQL:

SELECT pid,owner,src_small,src_big 
FROM photo 
WHERE aid IN (
    SELECT aid 
    FROM album 
    WHERE owner = your_page_id

Also you need to query the stream table to get the wall posts then check if you have attachments and the type of the attachment:

SELECT attachment
FROM stream 
WHERE source_id = 116860675007039


    "attachment": {
      "media": [
          "href": "",
          "alt": "test",
          "type": "photo",
          "src": "",
          "photo": {
            "aid": "6672812206410774346",
            "pid": "6672812206412558147",
            "fbid": 1801693052786,
            "owner": 1553635161,
            "index": 11,
            "width": 246,
            "height": 198
      "name": "",
      "caption": "",
      "description": "",
      "properties": [],
      "icon": "",
      "fb_object_type": "photo",
      "fb_object_id": "6672812206412558147"
    "attachment": {
      "description": ""
Thursday, April 1, 2021

I've worked around this by providing a login link on the page using the php-SDK getLoginUrl() and having the users use that instead of doing a client-side call to the javascript login() function or using the facebook social/login plugin. It might run into drawbacks at some point, but for now this seems to work on machine(s) that have 3rd party-cookies disabled

Thursday, April 1, 2021

Making a POST request to is outdated – you need to use /PAGE_ID/subscribed_apps now to subscribe to updates from a page.

Thursday, April 1, 2021

You'll need a Facebook app and to grant that app the ads_read permission in order to retrieve reports about your advertising efforts via the API (source).

You'll want a long-lived token so that you don't have to re-authenticate very often. The access token documentation details the steps to exchange a short-lived token for a long-lived one.

You may also want to consider managing the app, ad account, and access tokens (via a business system user) with the FB Business Manager.

Friday, October 1, 2021
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :