0

I have implemented exactly the code which is shown on this page: http://developers.facebook.com/docs/reference/dialogs/feed/

Problem: All the fields in the object are filled correctly, and also posted correctly to facebook, except the picture.

<?php

if(isset($_POST['successmessage'])) {

    echo '<div class="info_message" style="margin:0 10px 10px 10px">
            <div style="float:left;display:inline;width:200px">
                <strong>'.$lang['checkout_text_42'].' '.$lang['checkout_text_43'].'</strong>
                <br>'.$lang['checkout_text_44'].'
            </div>
            <div style="float:left;display:inline">
                <a onclick="postToFeed(); return false;" style="cursor:pointer;float:left"><img src="images/post-design-to-fb.png" style="margin-top:4px"></a>
                <div id="msg" style="line-height:34px;float:left;margin-left:10px"></div>
            </div>
            <div style="clear:left"></div>
        </div>';

    ?>

    <div id='fb-root'></div>
    <script src='http://connect.facebook.net/<?php echo $locale; ?>/all.js'></script>
    <script> 
      FB.init({appId: "123455666777", status: true, cookie: true });

      function postToFeed() {

        // calling the API ...
        var obj = {
          method: 'feed',
          link: 'http://www.mydomain.com/configurator.php?id=<?php echo $_SESSION['sharetofb'];?>&lang=<?php echo $language;?>',
          picture: 'http://www.mydomain.com/images/designs/design-<?php echo $_SESSION['sharetofb'];?>.png',
          name: 'I just designed a DIY T-Shirt. Awesome!',
          caption: 'Click to check it out and customize it.',
          description: 'Choose from 500 different materials, colors, prints, shapes to assemble your unique custom T-Shirt.'
        };

        function callback(response) {

            if (response && response['post_id']) {
               document.getElementById('msg').innerHTML = "Your design was posted successfully!";
             } 

        }

        FB.ui(obj, callback);
      }

    </script>

    <?php

}

?>

If I use the Direct URL Example given on the above mentioned facebook doc and copy/paste the url into the browser (substituted with my App ID and URL and content), it also shows everything except the picture.

The strange thing is: It showed and posted the picture yesterday. However after several times of testing and posting and deleting the the test posts from my wall, it didn't post the picture anymore.

I searched all the questions and answers here on stackoverflow and can exclude that it is a problem of having dashes in the picture url. I really cannot figure it out and are close to asuming that facebook is blocking post pictures if done too often??

Appreciate any hint which can lead me to the solution.

4

1 回答 1

0

您是否尝试过使用静态图片?它在工作吗?也许这取决于您传递给它的变量。

于 2012-07-18T10:50:46.763 回答