我已经实施了一种在Facebook上分享帖子的方法。我面临的问题是上传的GIF图像显示为静态图像而不是动画GIF。
通过Facebook上传图片时,结果类似。我尝试通过发布到'/ me / feed'并指定'picture'和'link'参数来实现替代解决方案,再次导致静态图像。
是否有替代方法可以解决此问题?
/// <summary>
/// Share status on facebook
/// </summary>
/// <param name="sharingData"></param>
/// <param name="accessToken"></param>
private void ShareStatus(SocialMediaShareData sharingData, string accessToken)
{
RestClient client = new RestClient(@"https://graph.facebook.com");
var url = string.Concat("/me/photos?access_token=", accessToken);
var request = new RestRequest(url, Method.POST);
request.AddParameter("access_token", accessToken, ParameterType.GetOrPost);
request.AddParameter("message", sharingData.Content, ParameterType.GetOrPost);
if (!sharingData.Image.IsNullOrHasZeroElements())
{
var imageExtension = sharingData.ImageExtension;
var name = sharingData.ImageName;
var mime = MimeTypeMap.GetMimeType(imageExtension);
request.AddFile("source", sharingData.Image, name, mime);
}
result = client.Execute(request);
}
答案 0 :(得分:0)
尝试在视频下上传。它对我有用。
$linkData = [
'message' => $gifyTitle,
'source' => $fb->fileToUpload($fileName)
];
$linkData["message"] = $gifyTitle;
$response = $fb->post('/me/videos', $linkData, $pageAccessToken);