tags:

views:

33

answers:

1

I need to display image that is in file system not in project directory in grails.. i used

< img src="${createLinkTo(dir: '/Users/ME/ddImages/reg/', file: '${userInstance.fileName}.jpg')}" alt="User Photo"/>

but that doesn't seem to work

so any help?

+2  A: 

BTW, the grails tag is depricated, use resource; and that tag will keep you within the application's base path

http://www.grails.org/Tag+-+createLinkTo

Documentation on the img tag http://www.w3schools.com/tags/att_img_src.asp,

Possible values for "src"

An absolute URL - points to another web site (like src="http://www.example.com/image.gif")
A relative URL - points to a file within a web site (like src="image.gif")
Aaron Saunders
yes i know it's depricated sir... but the thing is something like that.<img src="/Users/ME/ddImages/reg/1283427613720.jpg" alt="Grails"/>won't work for me and never get the image.. so what is the problem
Mohamed Emad Hegab
You want a rendered page on the client to load an image from a directory on the server - sorry, but it doesn't work that way. The client can only load the image from an absolute or relative URL (as Aaron mentioned). Either put the images under your application, or map the directory so that it is accessible from a URL.
Javid Jamae