【问题标题】:facebook api php news feed get large picturefacebook api php 新闻提要 获取大图
【发布时间】:2014-07-24 22:46:29
【问题描述】:

我在我的会员网站中添加新闻提要图片,需要帮助从新闻提要中获取大图片。

这是我获取新闻提要图片的代码

$json_object = @file_get_contents('https://graph.facebook.com/me/home?access_token=' . $fb_access_token); $news_feeds = json_decode($json_object, true);

foreach($news_feeds['data'] as $news_feed) 
{
echo '<img src="' . $news_feed['picture'] . '" />' . '<br />';
}

这给了我很好的新闻提要图片,但大小不同。

任何帮助都会很好!

我找了很久还是找不到答案?

这是我试图从中获取大图的 facebook 新闻提要数组的示例。

[id] => 1423830694520861_1508536172716979
                [from] => Array
                    (
                        [category] => Public figure
                        [name] => Dan Bilzerian
                        [id] => 1423830694520861
                    )

                [to] => Array
                    (
                        [data] => Array
                            (
                                [0] => Array
                                    (
                                        [category] => Public figure
                                        [name] => Jen Selter
                                        [id] => 244183679061369
                                    )

                            )

                    )

                [message] => Happy 21st to Jen Selter and her #NeverEndingAss
                [message_tags] => Array
                    (
                        [14] => Array
                            (
                                [0] => Array
                                    (
                                        [id] => 244183679061369
                                        [name] => Jen Selter
                                        [type] => page
                                        [offset] => 14
                                        [length] => 10
                                    )

                            )

                    )

                [picture] => https://scontent-b.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/p130x130/10563168_1508536129383650_2440015247017447728_n.jpg?oh=bfdb86c35b4b0ffe5a4ad9dbe65aba59&oe=54688CA7
                [link] => https://www.facebook.com/danbilzerianofficial/photos/a.1425329161037681.1073741829.1423830694520861/1508536129383650/?type=1&relevant_count=1
                [icon] => https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif

我相信我必须将 _n.jpg 更改为 _b.jpg 或 p130x130 到 b740x740 但该功能不起作用??

我尝试在 foreach 循环之前/之后运行此函数。但是还是不行?

$news_feed ['picture'] = str_replace("_n.jpg", "_b.jpg", $news_feed['picture']);

还有这个

$news_feed ['picture'] = str_replace("p130x130", "b740x740", $news_feed['picture']);

有人可以帮忙吗,:(谢谢

【问题讨论】:

  • 没有人可以帮忙?? :(请??
  • 这是寻求帮助的正确地方吗?或者只是一个愚蠢的问题哈哈? :(
  • 任何链接或教程会有帮助吗? ?仍然无法正常工作:(

标签: facebook facebook-graph-api facebook-php-sdk


【解决方案1】:

试试 object_id ....它对我有用 :)

echo '<img src="https://graph.facebook.com/' . $news_feed['object_id'] . '/picture?type=normal">' . '<br />';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-06
    • 2011-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多