1

我正在使用以下命令发布一些图像:

    $url_facebook  = "https://api.facebook.com/method/stream.publish?message=".$messaggio."&attachment={\"name\":\"".$title."\",\"href\":\"".$action_link."\",\"caption\":\"".$caption."\",\"description\":\"".$description."\",\"media\":[{\"type\":\"image\",\"src\":\"".$image."\",\"href\":\"".$action_link."\"}]}&action_links=[{\"text\":\"".$link_name."\",\"href\":\"".$action_link."\"}]&target_id=".$target_uid."&uid=".$source_uid."&".$site_token."";
    simplexml_load_file("".$url_facebook."");

我在墙上(一组)发布的图像是从 PHP 动态生成的。

这就是发生的事情:

  • 我生成图像并将其保存到文件夹
  • 我将其与代码一起发布
  • 我退出脚本
  • 下次运行脚本(每小时)时,我会删除所有旧创建的图像,而不是重复 wath sayid

我注意到刚刚发布的图像在 FB 墙上存在并存在

下次我启动脚本时(因此图像从我的网站中删除)它们也会从 facebook 中消失

我知道图片上传到 Facebook,所以我的空间不再需要它们了....

不是吗?

我也有这个疑问,因为如果我在 facebook 上看到红色 x(代替图片)

我右键单击“属性”,我可以阅读:

"https://s-platform.ak.fbcdn.net/www/app_full_proxy.php?app=164286063695472&v=1&size=z&cksum=17f253305254403324260843c7a6989a&src=http%3A%2F%2Fwww.graficisismici.it%2FV6_00%2Ffacebook%2Ffacebook_link_285790.jpg%3F285790"

所以看起来它真的是原始图像的链接你能解决我的疑问吗?

4

2 回答 2

0

同时我修改了脚本以使用新的 Graph Api

<?php

    $user = null;

    $facebook = new Facebook(array(
        'appId' => FACEBOOK_APP_ID,
        'secret' => FACEBOOK_SECRET,
        'cookie' => true
    ));

    $user = $facebook->getUser(); // Get the UID of the connected user, or 0 if the Facebook user is not connected.

    if($user == 0) {

            /**
             * Get a Login URL for use with redirects. By default, full page redirect is
             * assumed. If you are using the generated URL with a window.open() call in
             * JavaScript, you can pass in display=popup as part of the $params.
             * 
             * The parameters:
             * - redirect_uri: the url to go to after a successful login
             * - scope: comma separated list of requested extended perms
             */

            $login_url = $facebook->getLoginUrl($params = array('scope' => "publish_stream"));

            echo ("<script> top.location.href='".$login_url."'</script>");
    } else {
        $user_message = "Message";
        $titolo = "Titolo";
        $caption = "Caption";
        $link_name = "Link Name";
        $action_link = "Action Link";
        $testo = "Text";
        $image = "Image Link";

        $target_uid = "XXXXXXXX"; // ID where to publish    

        //HTTP POST request to PAGE_ID/feed with the publish_stream
        $post_url = '/'.$target_uid.'/feed';

            try {
                    $params = array(
                        'message' => $user_message,
                        'name' => $titolo,
                        'caption' => $caption,
                        'link' => $action_link,
                        'description' => $link_name,
                        'picture' => $image,
                        'actions' => array(
                                            array(
                                                'name' => $testo,
                                                'link' => $action_link
                                            )
                                        )  
                    );

                    $post = $facebook->api($post_url,"POST",$params);
                }
                catch (FacebookApiException $e) {
                   $result = $e->getResult();
                }

    }

?>

我只是想澄清一下图像问题。图像必须仍然存在吗?或者一旦发布,我可以删除它们,因为它们仍然存在于 Fb 上?

我的问题源于我在我网站的错误日志上看到(在使用这篇文章顶部的旧脚本时)一行 404 错误(与从 Fb 搜索的丢失图像有关)

于 2012-11-09T14:44:44.323 回答
0

我知道图片上传到 Facebook,所以我的空间不再需要它们了....

不是这种情况。Facebook 只是将您的内容缓存在他们的 CDN 中。如果您删除源照片,当内容从缓存中掉出时,他们刷新/重新填充缓存的尝试将失败,您的用户将获得一个损坏的图像图标。

图像必须仍然存在吗?或者一旦发布,我可以删除它们,因为它们仍然存在于 Fb 上?

你不应该删除它们。

于 2013-07-19T08:06:05.247 回答