我正在使用 C# FaceBook API 将状态更新和图像发布到墙上。我正在使用以下代码:
public string PostToFaceBookPage(string appKey, string appSecret, string wallId, string postMessage, string imageUrl)
{
string id = "";
if (string.IsNullOrEmpty(imageUrl))
imageUrl = "";
var client = new Facebook.FacebookClient();
dynamic result = client.Post("oauth/access_token",
new
{
client_id = appKey,
client_secret = appSecret,
grant_type = "client_credentials",
redirect_uri = "anywhere",
scope = "publish_stream"
});
client.AccessToken = (result)["access_token"];
if (!IsId(wallId))
{
result = client.Get(wallId);
id = result["id"];
} else
{
id = wallId;
}
if (imageUrl == "")
{
result = client.Post("/" + id + "/feed", new
{
message = postMessage,
scope = "publish_stream",
privacy = "{\"value\": \"EVERYONE\"}"
});
} else
{
var uri = new Uri(imageUrl);
string imageName = Path.GetFileName(uri.LocalPath);
string mimeType = GetMimeType(Path.GetExtension(uri.LocalPath));
var media = new Facebook.FacebookMediaObject
{
FileName = imageName,
ContentType = mimeType
};
media.SetValue(GetImage(imageUrl));
result = client.Post("/" + id + "/feed", new
{
message = postMessage,
source = media,
picture = imageUrl,
scope = "publish_stream",
privacy = "{\"value\": \"EVERYONE\"}"
});
}
return "";
}
一切正常。我唯一的问题是,无论实际图像的大小如何,我的图像都发布了相同的确切尺寸。有没有办法告诉 FaceBook 图像的大小,这样它就不会只发布图像的小缩略图?