图像渲染问题 [英] Image rendering issue
本文介绍了图像渲染问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个代码可以根据表格中的数据生成图像。它在我的本地系统上运行正常。当我在生产中部署它时我得到没有错误但图像也没有显示
下面是生成图像的代码片段。你能指导一下可能出现的问题。
//更改响应标题以输出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"); }
这篇关于图像渲染问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文