I am very new to grails.I am doing one sample project for image uploading and displaying.Right now my project uploads the images and stores into the images directory.Now i want to display all the images stored in the ‘image’ directory. I dont know how to write the gsp code for display all images.
For displaying the images I wrote the following code in list.gsp page.
My gsp code is:
<g:each in='${imageList}' var='image'> <img src='${createLinkTo(dir: 'images', file: '1.jpg')}' alt='Grails'/> </g:each>
imageList has filenames of images in the image directory.
In the second line i want put filename instead of ‘1.jpg’.
Can any one tell me how to display the images.
thanks
If your imageList has list of image objects try the following
${createLinkTo(dir: ‘images’, file: image.filename)}.
If your imageList like this[‘1.jpg’,’2.jpg’,’3.jpg’] try the following