图像渲染问题

编程入门 行业动态 更新时间:2024-10-28 11:30:35
本文介绍了图像渲染问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我有一个代码可以根据表格中的数据生成图像。它在我的本地系统上运行正常。当我在生产中部署它时我得到没有错误但图像也没有显示 下面是生成图像的代码片段。你能指导一下可能出现的问题。 //更改响应标题以输出JPEG图像。

this.Response.Clear(); this.Response.ContentType =image / jpeg; System.Drawing.Image OC = null; //构建图像 string imageName = Request.QueryString [ID]; if(Cache [imageName]!= null) { OC =(System.Drawing.Image)Cache [imageName]; //以JPEG格式将图像写入响应流。 OC.Save(this.Response.OutputStream,ImageFormat.Jpeg); OC.Dispose(); }

解决方案

可能是因为未达到IF条件,请在else块中加入一些代码。示例:

else { this .Response.Write( 错误); }

Hi All, I have a code which genrates an image based on data in table. It works fine on my Local system. When i deploy it on production i get no error but the image also is not getting displayed Below is the code snippet which generates an image. Can you please guide me what can be the issue. // Change the response headers to output a JPEG image.

this.Response.Clear(); this.Response.ContentType = "image/jpeg"; System.Drawing.Image OC = null; //Build the image string imageName = Request.QueryString["ID"]; if (Cache[imageName] != null) { OC = (System.Drawing.Image)Cache[imageName]; // Write the image to the response stream in JPEG format. OC.Save(this.Response.OutputStream, ImageFormat.Jpeg); OC.Dispose(); }

解决方案

It could be that the IF condition is not reached, please put some code in the else block too. Example:

else {this.Response.Write("Error"); }

更多推荐

图像渲染问题

本文发布于:2023-10-30 01:25:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541355.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!