【问题标题】:Fancybox, how maximaze pictures using image controller?Fancybox,如何使用图像控制器最大化图片?
【发布时间】:2010-08-31 09:54:08
【问题描述】:

我正在使用 fancybox 来处理我的 Java Web 应用程序中的图像。 这是my.jsp的一些代码:

<c:forEach var="imageName" items="${requestScope.myCollection.imageNames}"> <a rel="image_group" href="/My_War/large/${imageName}.do" title="${imageName}"><img alt="" src="/My_War/small/${imageName}.do" /></a> </c:forEach>

这是我的 spring 图像控制器的功能之一,它将图像写入字节流:

@ExceptionHandler(IOException.class) @RequestMapping(value = "/large/{name}.do", method = RequestMethod.GET) protected void getLargeImage(@PathVariable("name") String name, OutputStream outStream) throws IOException{ //here I read an image as byte stream and write it into output stream outStream.write(Utils.readImageFromFolder(name, false)); outStream.flush(); outStream.close(); }

所以我很难最大化图像。小图像加载正确,但是当我单击它们时,它会显示垃圾。我知道,它应该是我的 jsp 中真实图像的链接,而不是图像控制器的链接。那么我该如何解决这个问题呢?请帮忙:)

【问题讨论】:

    标签: jquery jquery-plugins fancybox


    【解决方案1】:

    我找到了解决方案;这很简单:) 只需添加属性: “类型”:“图像” 到fancybox config)))

    【讨论】:

      【解决方案2】:

      Fancybox 缺少请求的类型,因为您指向的是 .jsp 页面,然后它会自动将其检测为 Ajax。

      在 URL 的末尾附加一个虚拟参数 &type=.jpg 或 png 或其他任何内容,或者按照您所说的设置 'type':'image'。

      干杯!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-07-15
        • 1970-01-01
        • 1970-01-01
        • 2020-12-25
        • 2023-03-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多