using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OASystem.Domain.Dtos.Tencent { /// /// OCR Request Param Verify Method /// public static class OCRVerifyMethod { /// /// TencentOCR图片类型处理 /// PNG、JPG、JPEG、BMP /// /// /// public static bool ImageType(string type) { string[] picBase64Array = type.Split(';'); string picFormat = picBase64Array[0].Split('/')[1]; if (picFormat.ToLower().Equals("png") || picFormat.ToLower().Equals("jpg") || picFormat.ToLower().Equals("jpeg") || picFormat.ToLower().Equals("bmp")) return true; return false; } /// /// TencentOCR图片大小处理 /// 不能大于7MB /// /// /// public static bool ImageSize(string picBase64) { double strSize = 1024 * 1024 * 7; if (picBase64.Length < strSize) { return true; } return false; } } }