【发布时间】:2011-05-01 16:22:12
【问题描述】:
为了在我的网站上显示完整尺寸的图像,我决定使用 Jquery.colorbox,这个插件适用于静态图像位置,例如:
<a rel="ex1" href="http://www.blah.com/image.jpg"><img src="http://www.blah.com/image_thumb.jpg"/></a>
但是当我想使用二进制读/写从目录中获取图像时,这个插件向我显示垃圾数据而不是编译后的 jpg/图像,如下所示:
<a rel="ex1" href="http://www.blah.com/getimage.aspx?id=1234"><img src="http://www.blah.com/getimage.aspx?id=1234"/></a>
这是我获取动态图像的 sn-p 代码:
thumbLocation = DataHelper.GetItemPicture(recordID);
using (FileStream IMG = new FileStream(thumbLocation, FileMode.Open))
{
//FileStream IMG = new FileStream(thumbLocation, FileMode.Open);
byte[] buffer = new byte[IMG.Length];
IMG.Read(buffer, 0, (int)IMG.Length);
Response.Clear();
Response.ContentType = "image/JPEG";
Response.AddHeader("Content-Length", buffer.Length.ToString());
Response.BinaryWrite(buffer);
Response.End();}
我该如何解决这个问题?
【问题讨论】:
-
您是否检查过问题是否与
getimage.aspx无关? 那个似乎可以正常工作吗?
标签: c# jquery asp.net colorbox