Grails: - 如何在文件系统中显示图像 [英] Grails:-How To display image in file system

查看:95
本文介绍了Grails: - 如何在文件系统中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在grails中显示文件系统中不在项目目录中的图像。
i使用

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

但这似乎不起作用



所以有什么帮助?

解决方案

顺便说一句,grails标记被depricated,使用资源;并且该标签将使您保持在应用程序的基本路径中

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



关于img标签的文档
http://www.w3schools.com/tags/att_img_src.asp



src的可能值

 绝对网址 - 指向另一个网站(如src =http://www.example.com/image.gif)
相对URL - 指向网站中的文件(如src =image.gif)


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?

解决方案

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")

这篇关于Grails: - 如何在文件系统中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆