Example #1
0
        public static string ValidateImage(this string imagePath)
        {
            string src = string.Empty, url = string.Empty;
            var    query = "";

            try
            {
                if (!string.IsNullOrEmpty(imagePath))
                {
                    src = HttpContext.Current.Server.MapPath(String.Concat("~/", imagePath));

                    url = File.Exists(src) ? PictureService.BuildUrlCore(imagePath, query, null) : PictureService.BuildUrlCore(Constant.ImageNoExsits, query, null);
                }
                else
                {
                    url = PictureService.BuildUrlCore(Constant.ImageNoExsits, query, null);
                }
            }
            catch (Exception ex)
            {
                string exx = ex.Message;
            }

            return(url);
        }