简体   繁体   English

通过Facebook App在用户墙上发布帖子

[英]Publishing a post on users' wall by facebook app

I need to generate a picture from facebook user profile picture and post it to some users' walls. 我需要从facebook用户个人资料图片生成图片并将其发布到某些用户的墙上。 For instance, $attch = array( 'media' => array((array('type' => 'image', 'src' => ' https://graph.facebook.com/ '.$uid.'/picture', 例如,$ attch = array('media'=> array((array('type'=>'image','src'=>' https://graph.facebook.com/'。$ uid。'/图片',
'href' => ' https://graph.facebook.com/ '.$uid.'/picture/'))); 'href'=>' https://graph.facebook.com/'。$ uid。'/ picture /'))));

'src' => ' https://graph.facebook.com/ '.$uid.'/picture' line doesn't show any picture... 'src'=>' https://graph.facebook.com/'。$ uid。'/ picture'行不显示任何图片...

How can I resolve this? 我该如何解决?

Thanks 谢谢

I answered this in your duplicate question . 我在你重复的问题中回答了这个问题

It's not showing a picture because there's nothing at https://graph.facebook.com/[user id]/picture. 它没有显示图片,因为https://graph.facebook.com/ [用户 ID] / picture中没有任何内容。 You need to query https://graph.facebook.com/[user id] and parse the JSON to get its URL. 您需要查询https://graph.facebook.com/ [用户 ID]并解析JSON以获取其URL。

You are going to the right place for the picture: 您将转到图片的正确位置:

http://graph.facebook.com/[username or id]/picture/ returns a redirect to the image on Facebook's CDN. http://graph.facebook.com/ [用户名或ID] / picture /返回重定向到Facebook CDN上的图像。

You can try it in a browser. 您可以在浏览器中尝试。

I don't know what you're doing with that array but the likely problem with your code is that you are not following the redirect to find the actual image. 我不知道您在使用该数组做什么,但是您的代码可能出现的问题是您没有按照重定向来查找实际图像。

The image that the picture URL redirects to can change over time so you should always go to it first and follow the redirect. 图片URL重定向到的图像可能会随着时间而变化,因此您应始终先转到该图像并遵循重定向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM