Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Jquery colorbox和通过Aspx读取的动态图像时出现问题_C#_Jquery_Asp.net_Colorbox - Fatal编程技术网

C# 使用Jquery colorbox和通过Aspx读取的动态图像时出现问题

C# 使用Jquery colorbox和通过Aspx读取的动态图像时出现问题,c#,jquery,asp.net,colorbox,C#,Jquery,Asp.net,Colorbox,为了在我的网站上显示全尺寸图像,我决定使用Jquery.colorbox,该插件可以很好地用于静态图像位置,如: <a rel="ex1" href="http://www.blah.com/image.jpg"><img src="http://www.blah.com/image_thumb.jpg"/></a> 我如何解决这个问题?一些想法 将内容类型更改为“image/jpeg”(大写可能很重要) 将以下内容添加到url的末尾&thisisan.j

为了在我的网站上显示全尺寸图像,我决定使用Jquery.colorbox,该插件可以很好地用于静态图像位置,如:

<a rel="ex1" href="http://www.blah.com/image.jpg"><img src="http://www.blah.com/image_thumb.jpg"/></a>
我如何解决这个问题?

一些想法

  • 将内容类型更改为
    “image/jpeg”
    (大写可能很重要)

  • 将以下内容添加到url的末尾
    &thisisan.jpg
    (如果某些浏览器在url末尾没有看到此内容,则不会创建图像)

  • 通过将图像url直接放入浏览器进行测试


使用colorbox的照片属性。例如:

$('a.example').colorbox({photo:true})


原因是colorbox自动检测图像URL的正则表达式对于此类URL(不包含图像类型扩展名)将失败。

您是否检查了问题是否与
getimage.aspx
有关?这看起来行吗?@austin-这和我的第二个选择一样,把.jpg放在URL的末尾也会有同样的效果。太棒了!我已经为此奋斗了两个小时。这是我的核心。
<a rel="ex1" href="http://www.blah.com/getimage.aspx?id=1234"><img src="http://www.blah.com/getimage.aspx?id=1234"/></a>
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();}