/// <summary> /// 获取图片附件的宽度和高度 /// </summary> private void CheckImageInfo(Stream stream) { if (MediaType == MediaType.Image) { string contentType; int width; int height; if (ImageMetadata.Check(stream, out contentType, out width, out height)) { this.ContentType = contentType; this.Width = width; this.Height = height; } } }