图片加载完成后,才会有width
同求
解决了吗你这个问题?你可以在Image的onload事件中获取宽高,然后在去判断
System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
stream就是你上传图片
Stream strsrc = new MemoryStream(ASCIIEncoding.Default.GetBytes(srcb64));
System.Drawing.Image img = System.Drawing.Image.FromStream(strsrc);
str = img.Width + "," + img.Height;
我这么写的,“strsrc.ReadTimeout”引发了“System.InvalidOperationException”类型的异常 这个错误怎么解决啊?
img.onload