FB.UI Feed对话框 - 不能“共享”一个Facebook的图片 [英] FB.UI Feed Dialog - cannot "share" a facebook's picture

查看:357
本文介绍了FB.UI Feed对话框 - 不能“共享”一个Facebook的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用移动网络应用程序分享facebook照片(真的是facebook照片) Feed对话框



问题: 无法将Facebook的照片发送到Feed对话框。



所有代码都很好用。我发送到函数时获取所有属性。

  FB.ui 
方法:feed
link:'url'
app_id :myAppID
名称:'照片的名称'
描述:''
caption:$('#albumName')。text()
图片:'http:// myUrl。 com / logo.png'

,(响应) - >
如果response和response.post_id
console.log'照片被共享'
else
console.log'照片未共享。请重试'

如果我放置一个静态照片, 图片参数,一切正常,如果我尝试调用一个Facebook图片,我尝试共享,然后我收到一个500服务器错误。


GET
https://www.facebook.com/dialog/feed?access_token=..662390597_s.jpg&sdk=joey
500 (OK)


这是完全奇怪的。访问对话框iframe的URL将包含所有必需的参数,包括access_token。



这似乎是一个设计问题。就像Facebook里的某个人,当我们分享Facebook的照片时,我们在使用自己的饲料对话方式定制分享时,不希望我们假装成为Facebook。



我是对的? / p>

*解决问题。请看下面的答案*

解决方案

!!!解决问题



Facebook不接受自己的CDN作为来源。我们需要绕过它才能分享,因此我们可以使用代理转发Facebook的照片。



http://images.weserv.nl 做这项工作。 Facebook接受图片作为图片参数,这样你就可以转贴他们的帖子。



使用示例(加宽度和高度来提高性能)

 'https://images.weserv.nl/?url='+ facebookImageUrl +'& h = 200& w = 200'


Sharing facebook photo (really a facebook photo) using mobile web app & Feed Dialog.

The problem: Cannot send facebook's photo to the Feed Dialog.

All code works great. I get all properties as they sent to the function.

    FB.ui
        method: "feed"
        link: 'url'
        app_id: myAppID
        name: 'photo's name'
        description: ''
        caption: $('#albumName').text()
        picture: 'http://myUrl.com/logo.png'

    , (response) ->
        if response and response.post_id
            console.log 'Photo was shared'
        else
            console.log 'Photo was not shared. Please try again'

If I place a static photo, to represent the Picture parameter, all goes fine, But if I try to call a facebook picture I try to share, then I get a 500 server error.

GET https://www.facebook.com/dialog/feed?access_token=...662390597_s.jpg&sdk=joey 500 (OK)

This is totally bizarre. The URL that goes to the dialog iframe, goes with all the needed parameters, including access_token.

It seems like a design issue. Like someone in facebook don't want us to pretend to be facebook when we customly share things using their feed dialog, when we share facebook photos.

Am I right?

* Problem Solved. See my answer below *

解决方案

!!! Problem Solved !!!

Facebook don't accept their own CDN as a source. We need to bypass that in order to share, therefore we can reshare a facebook the photo using a proxy.

http://images.weserv.nl does the job. Facebook accept the image as a picture param, and this way you are able to reshare their posts.

Usage example (plus width and hight to improve performance)

'https://images.weserv.nl/?url=' + facebookImageUrl + '&h=200&w=200'

这篇关于FB.UI Feed对话框 - 不能“共享”一个Facebook的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆