Kanwal Nain Singh solution works only if server is running in local but if I download template in doc format from remote then again image is missing. The problem is doc search image in local machine(/opt/profileImages folder).
Following code is working perfectly:
Action:
def showUserProfileImage() {
String profilePicturePath = "${grailsApplication.config.profilePictureDirectoryPath}/${params.id}"
File file = new File(profilePicturePath)
response.contentType = URLConnection.guessContentTypeFromName(file.getName())
response.outputStream << file.bytes
response.outputStream.flush()
}
Tag:
<g:img uri="${grailsApplication.config.grails.serverURL}/user/showUserProfileImage/${userImageName}"/>