| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace OASystem.Domain.Dtos.Tencent{    /// <summary>    /// OCR Request Param Verify Method    /// </summary>    public static class OCRVerifyMethod    {        /// <summary>        /// TencentOCR图片类型处理        /// PNG、JPG、JPEG、BMP        /// </summary>        /// <param name="type"></param>        /// <returns></returns>        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;        }        /// <summary>        /// TencentOCR图片大小处理        /// 不能大于7MB        /// </summary>        /// <param name="picBase64"></param>        /// <returns></returns>        public static bool ImageSize(string picBase64)        {            double strSize = 1024 * 1024 * 7;            if (picBase64.Length < strSize)            {                return true;            }            return false;        }    }}
 |