using (WebClient wc = new WebClient())
{
using (Stream s = wc.OpenRead("https://graph.facebook.com/" + userid + "/picture?type=normal"))
{
using (Bitmap bmp = new Bitmap(s))
{
ImageConverter converter = new ImageConverter();
Byte[] bytes1 = (byte[])converter.ConvertTo(bmp,typeof(byte[]));
String prof = Convert.ToBase64String(bytes1);
facebookuser.profilepic = prof;
}
}
}
cmd.Parameters.AddWithValue("@profilepic", Encoding.Default.GetBytes(_profilepic));
嗨,我正在尝试存储Facebook个人资料图片和显示内容,但似乎我存储的字节是错误的,因为使用此代码存储后没有图像显示。我可以知道转换为字节时有什么错误吗?