Facebook在页面选项卡中更改图像 [英] Facebook change image in page tab

查看:74
本文介绍了Facebook在页面选项卡中更改图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以编程方式更改Facebook页面标签图像.这个想法是当我的应用程序完成安装过程时,它将更改放置它的选项卡的图像.完成该过程并授予该应用程序权限后,fb的响应将被未经授权"

I'm trying to change a facebook page tab image programatically. The idea is when my app will finish the instalation process, it will be change the image of the tab where it place it. After finish the process and give permissions to the app, The response of fb is "unautorized"

{"error":{"message":"(#300) Edit failure","type":"OAuthException","code":300}}

我搜索了此错误,最接近的方式是: https://developers.facebook.com/bugs/255313014574414/.我尝试了错误中所述的相同CURL示例,并且具有相同的响应.

I searched about this error, the most close aproach was: https://developers.facebook.com/bugs/255313014574414/. I tried the same CURL example described in the error and have the same response.

奇怪的是,当我尝试更改fb中的图像时,它也失败了.我认为问题出在应用程序要求在用户页面上安装权限而没有足够的许可时.

The strange thing is, when i tried change the image inside fb, it fails too. I think the problem is when the app ask permissions to install in the user page, and don't have enough permits.

但是我不知道我要更改许可证以授权更改页标签的图像.

But i don't know hot i chage the permit to authorize chage the image of the pagetab.

推荐答案

var fbparams = new Dictionary<string, object>();
          string path = @"c:\test.jpg";
          FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
      var picture = new FacebookMediaObject
                {
                        //Tell facebook that we are sending image
                    ContentType = "image/jpeg",
                    //Give name to the image
                    FileName = "test"
                };
                //Create a new byteArray with right length
                var img = tabImageInfo.Media;
                //Convert the image content into bytearray
               fs.Read(img, 0, img.Length);`enter code here`
                 //Close the stream
               fs.Close();
                //Put the bytearray into Picture
                picture.SetValue(img);
                //Add the image into parameters
                fbparams.Add("custom_image", picture);
        fb.Post(tab.id, fbparams);

这篇关于Facebook在页面选项卡中更改图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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