0

Possible Duplicate:
Grails: displaying created image in gsp

I'm trying to display images from database in <g:each> tag.

my domain-class:

class Artists {
    byte[] image

    String artistName
    String bio

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

}

and artists.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>

help please !!!

Community
  • 1
  • 1
Dima M.
  • 1
  • 1

1 Answers1

0

You can render the image inline the way you're attempting using the rendering plugin, and the following gsp tag (This is for a png Check Inline Images in the docs for other content types):

<rendering:inlinePng bytes="${it.image}"/>
Kevin Stricker
  • 17,178
  • 5
  • 45
  • 71