grails display images in folder
问题 I'm trying to do a Grails webapp and now I'm trying to display all images in a folder. To do that I have the following: def display(){ def dir = new File("/tmp/images") def list = [] dir.eachFileRecurse() { file -> def avatarFilePath = new File(file.path) response.setContentType("application/jpg") OutputStream out = response.getOutputStream(); out.write(avatarFilePath.bytes); out.close(); } } So using the code above I'm displaying one image using: <img class="thumbnail" src='${createLink