Hello, when i share from my website (i made a facebook app) to my facebook account, the post doesnt show an image of the post i share? I mean it shows the text i have written, it shows the name of the app, it redirects to my website (app) but it doesnt show any image although there are images on the page i share. Any hints?

Dani AI

Generated

As pointed out, Facebook will use Open Graph metadata to decide which single image to show; if OG tags are missing or invalid, the crawler falls back to other images on the page. The Open Graph protocol lists the required properties (og:title, og:type, og:image, og:url) and the optional image sub‑properties (og:image:width, og:image:height, og:image:alt) that help the platform choose and render the thumbnail. (Open Graph protocol). (ogp.me)

Quick checklist (apply in order):

  • Confirm an absolute og:image URL is present in the page head (not injected later by JS) and that structured tags like og:image:width/og:image:height are included where possible.
  • Make sure the image meets Facebook’s display guidance (best: 1200×630; minimums vary—small images may be ignored or shown small). (Open Graph image guidance summary).
  • Use a link‑preview tool to see what Facebook actually fetched and to force a re‑scrape. (how to clear FB cache / Sharing Debugger steps). (ogpreview.io)

Quick server checks (run from a shell to simulate the FB crawler):

# check page headers as facebookexternalhit
curl -I -A 'facebookexternalhit/1.1' 'https://example.com/page-url'

# check image headers (status, content-type, size)
curl -I -A 'facebookexternalhit/1.1' 'https://example.com/path/to/image.jpg'

The Facebook crawler identifies itself as variants of facebookexternalhit; the image must return 200, a correct image MIME type, and not be behind hotlink protection or auth. If the crawler sees 403/404, redirects that require cookies, or unusual TLS issues, the image won’t be used. (useragents.io)

Notes specific to ’s approach: creating Open Graph objects via the API will only work if the object URL resolves publicly and the page it points to contains correct OG tags (image URL absolute, reachable, and sized). Server‑side syntax errors (unquoted strings, trailing commas) will break API calls; if the object was updated, force Facebook to re‑scrape the object URL and check the object properties in the debugger. Adding og:image:width / og:image:height often stabilizes which image is picked. (ogp.me)

Recommended Answers

All 2 Replies

Thanks Dani. I have created an Open Graph story. Maybe you can clear something for me... I am thinking of using the PHP SDK code provided by Facebook

here is the code

$response = $facebook->api(
  'me/objects/rovespier:art',
  'POST',
  array(
    'og:url' => 
    'og:title' => Sample Art,
    'og:type' => rovespier:art,
    'og:image' => 
    'og:description' => ,
    'fb:app_id' => 34954712323
  1. I dont know if there is more than this php code to implement to my site to show image, title etc
  2. Where do i put the code? Anywhere i want?
    this is the facebook code i use to share and like

         <script>
                          window.fbAsyncInit = function() {
                            FB.init({
                              appId      : '34954712323',
                              xfbml      : true,
                              version    : 'v2.1'
                            });
                          };
    
                          (function(d, s, id){
                             var js, fjs = d.getElementsByTagName(s)[0];
                             if (d.getElementById(id)) {return;}
                             js = d.createElement(s); js.id = id;
                             js.src = "//connect.facebook.net/en_US/sdk.js";
                             fjs.parentNode.insertBefore(js, fjs);
                           }(document, 'script', 'facebook-jssdk'));
                            FB.ui({
         method: 'share_open_graph',
         action_type: 'og.likes',
         action_properties: JSON.stringify({
          object:'https://developers.facebook.com/docs/',
         })
        }, function(response){});
                        </script>
                        <div class="fb-like" data-share="true" data-width="250" data-show-faces="true">
                        </div>
      )
    );
    
  3. I am trying to put my variable next to 'og:image' => https:'.$base_url.$profile_path.$row['profile_pic'];
    and i make getting an error. So i know that this is wrong.

This is the http code i got from facebook


access_token=ACCESS_TOKEN&
method=POST&
object=%7B%22og%3Aurl%22%3A%22http%3A%5C%2F%5C%2Fsamples.ogp.me%5C%2F407704082730386%22%2C%22og%3Atitle%22%3A%22Sample+Art%22%2C%22og%3Atype%22%3A%22rovespier%3Aart%22%2C%22og%3Aimage%22%3A%22https%3A%5C%2F%5C%2Ffbstatic-a.akamaihd.net%5C%2Fimages%5C%2Fdevsite%5C%2Fattachment_blank.png%22%2C%22og%3Adescription%22%3A%22%22%2C%22fb%3Aapp_id%22%3A349547121879416%7D
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.