Comments (2)
private static string ImgToBase64String(string Imagefilename)
{
try
{
Bitmap bmp = new Bitmap(Imagefilename);
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] arr = new byte[ms.Length];
ms.Position = 0;
ms.Read(arr, 0, (int)ms.Length);
ms.Close();
String strbaser64 = Convert.ToBase64String(arr);
return strbaser64;
}
catch (Exception ex)
{
//LogHelper.Debug(ex);
return "";
}
}
private static async void WechatyMessageEventListenerAsync(Wechaty.User.Message message)
{
if (message.Text == "图片图片")
{
var base64 = ImgToBase64String(@"C:\xxx.png");
var fileBox2 = FileBox.FromBase64(base64, "xx.png");
await message.Say(fileBox2);
}
}
目前先按照这样的来处理,至于卓桓所提的FileBox的版本问题,我后面看下是不是.net wechaty需要同步更新下
from dotnet-wechaty.
Thanks for reporting this problem!
This issue is related to:
We have made some fixes and the latest version Wechaty should have updated with the fix.
Please try the [email protected]
or above version to see if it can fix your problem, and feel free to let us know whether it works or not.
from dotnet-wechaty.
Related Issues (20)
- Save the message and resend later HOT 2
- .NET Wechaty 发布进展
- .NET Wechaty Contributors 招募 HOT 2
- Support WECHATY_PUPPET_SERVICE_TOKEN HOT 6
- WECHATY_LOG environment variable specification (valid values)
- System.Exception: 获取hostie gateway 对应的主机信息异常 HOT 2
- Question about eventType Dirty in gRPC HOT 1
- HttpRequestException: The SSL connection could not be established, see inner exception. HOT 2
- Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. IOException: Cannot determine the frame size or a corrupted frame was received HOT 1
- WECHATY_PUPPET_SERVICE_Endpoint应该填什么内容 HOT 1
- 消息发送时候报错 HOT 3
- add room member failed, error code: -2001, error message: 由于系统升级,该功能无法使用,请升级版本 HOT 2
- Grpc errors while concurrently connecting to 2 Wechat bots in 1 process or in 2 processes on 1 machine HOT 1
- The SSL connection could not be established-WeChaty 0.68, C#SDK HOT 1
- 在本地搭建js环境,让c#调用,从而使得wechaty跑起来
- NetCore8,调用say方法,报错:no payload HOT 7
- Wechaty class error HOT 3
- Puppet is abstract class, can't construct it. HOT 2
- Can't send Message after logging in a while. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet-wechaty.