C# 记事本
1、后端获取切片
/// <summary> /// 获取配置文件中的地图参数 /// </summary> /// <returns></returns> [HttpGet] public void GetTitle(int x,int y,int z) { String url = "http:XXXX/14/2919/13629"; WebRequest myrequest = WebRequest.Create(url);//前台js传的path,可以是远程服务器上的,也可以是本地的 WebResponse myresponse = myrequest.GetResponse(); Stream imgstream = myresponse.GetResponseStream(); System.Drawing.Image img = System.Drawing.Image.FromStream(imgstream); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); Response.AddHeader("Content-Length", ms.Length.ToString()); Response.Clear(); Response.ContentType = "image/jpeg"; Response.BinaryWrite(ms.ToArray()); Response.OutputStream.Flush(); Response.OutputStream.Close(); }
posted on 2020-06-16 10:26 Geography爱好者 阅读(175) 评论(0) 编辑 收藏 举报