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?

Recommended Answers

It's only going to share one image from the page. You can use the Open Graph syntax to tell Facebook which image you want that to be.

<meta property="og:image" content="http://www.example.com/image.gif" />

More information at:

Jump to Post

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' => http://samples.ogp.me/407704082730386,
    'og:title' => Sample Art,
    'og:type' => rovespier:art,
    'og:image' => https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png,
    '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

https://graph.facebook.com/me/objects/rovespier:art?
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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.