Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用fb.api保存画布图像并共享到facebook_C#_Javascript_Jquery_Html2canvas - Fatal编程技术网

C# 如何使用fb.api保存画布图像并共享到facebook

C# 如何使用fb.api保存画布图像并共享到facebook,c#,javascript,jquery,html2canvas,C#,Javascript,Jquery,Html2canvas,我想将画布图像保存到文件夹中,并在登录用户的墙上的facebook中共享。我使用的是html2canvas插件,但我的问题是画布中没有绘制div元素。div中的数据来自数据库。下面是我编写的代码 HTML代码: <div class="fan_wrap"> <ul class="fan_list"> <% foreach (ProfileDetails currentFollowers in AllFollowers

我想将画布图像保存到文件夹中,并在登录用户的墙上的facebook中共享。我使用的是html2canvas插件,但我的问题是画布中没有绘制div元素。div中的数据来自数据库。下面是我编写的代码

HTML代码:

<div class="fan_wrap">
         <ul class="fan_list">
                <% foreach (ProfileDetails currentFollowers in AllFollowers)
                  {
                  %>
  <li <%if (currentFollowers.ID != 0) { Response.Write("class=\"locate\""); } %>>
  <img src="<%=currentFollowers.ProfileImg %>" alt="<%=currentFollowers.Name %>" title="<%=currentFollowers.Name %>" />
   <div class="frame"></div>
     </li>
     <%} %>
   </ul>
    <div class="clearfix"></div>
    <div class="logo_water_mark">
    <img src="images/trans_logo.png" alt="" />
     </div>
    </div>

首先,你必须将画布图像保存在你想要共享它的域中,因为你的facebook应用程序只支持一个。接下来,您可以共享要共享的pic的url,如下所示:

FB.ui({
                                method: 'feed',
                                name: "some name",
                                link: "somelink.com",
                                picture: urltobeshared,
                                caption: 'some caption',
                                description: "some descrtiption",
                              },
                              function(response) {
                                if (response && response.post_id) {
                                  console.log('Thank you');
                                }                  
                              }
                        );
                    },

文档是。希望这有助于

确定您和我如何绘制图像到画布图像路径来自facebook graph URL我不确定您的问题是什么,但如果您询问如何在画布上绘制图像,则非常简单。检查此()w3schools的示例,您将理解。此外,在画布上绘制图像时,如果您关心的是图像的来源,则无需关心图像的来源。希望它能帮助您仅当您的图像包含在同一本地服务器中时,此示例才有效如果我想编写外部图像url,则我无法做到“SomeimageObj.crossOrigin=”匿名“;”试着把这张画在画布上,希望对你有所帮助。
FB.ui({
                                method: 'feed',
                                name: "some name",
                                link: "somelink.com",
                                picture: urltobeshared,
                                caption: 'some caption',
                                description: "some descrtiption",
                              },
                              function(response) {
                                if (response && response.post_id) {
                                  console.log('Thank you');
                                }                  
                              }
                        );
                    },