Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            int    width         = Convert.ToInt32(context.Request.QueryString["width"]);
            int    height        = Convert.ToInt32(context.Request.QueryString["height"]);
            string pictureFileNo = context.Request.QueryString["pictureFileNo"].ToString();
            string type          = context.Request.QueryString["type"].ToString();



            //V2版 走CDN图片---此方法不能正常显示PNG GIF等带透明度的图片格式
            //GetPicII.ashx方法支持PNG GIF等格式,但是不走CND
            string picUrl = ServicePic.ResolveUGCImage(GetType(type), pictureFileNo, width, height);

            context.Response.Redirect(picUrl, true);
        }
Пример #2
0
        public string SaveImg(int imgWidth = 0, int imgHeight = 0, int imgLength = 1000)
        {
            HttpPostedFileBase file          = Request.Files["imgfile"];
            CommonService      commonService = new CommonService();

            rsPic.Clear();
            if (file.ContentLength > 0 && file != null)
            {
                rsPic = commonService.PostImg(file, "width:" + imgWidth + ",Height:" + imgHeight + ",Length:" + imgLength);
                if (rsPic.Keys.Contains("success"))
                {
                    return("{\"status\":0,\"message\":\"" + ServicePic.ResolveUGCImage("2", rsPic["success"], imgWidth, imgHeight) + "\"}");
                }
                if (rsPic.Keys.Contains("error"))
                {
                    return("{\"status\":1,\"message\":\"" + rsPic["error"] + "\"}");
                }
            }
            return("{\"status\":1,\"message\":\"上传图片异常\"}");
        }