0

可能重复:
Grails:在 gsp 中显示创建的图像

我正在尝试在<g:each>标签中显示数据库中的图像。

我的域类:

class Artists {
    byte[] image

    String artistName
    String bio

    static constraints = {
        image(nullable:true , maxSize:200000)
        artistName(nullable:true)
        bio(nullable:true, maxSize:2000)
    }

}

艺术家.gsp:

<g:each in="${dog.Artists.list()}">
    <g:img src="${it.image }" width="120" height="160"/>  //doesn't work, what should I do here???
    <p>Name: ${it.artistName}</p>                         //works  
    <p>Biography: ${it.bio}</p>                           //works
</g:each>

请帮忙 !!!

4

1 回答 1

0

您可以使用渲染插件和以下 gsp 标签(这是用于 png 检查其他内容类型的文档中的内联图像)以尝试内联方式渲染图像:

<rendering:inlinePng bytes="${it.image}"/>
于 2012-07-21T06:44:50.770 回答