Fórumok
Inserting Image in velocity HTML code
John Voltaire Maximo, módosítva 8 év-val korábban
Inserting Image in velocity HTML code
Regular Member Bejegyzések: 106 Csatlakozás dátuma: 2015.06.19. Legújabb bejegyzések
Hi guys,
I'm creating a theme template using velocity, however I can't seem to get the image that I wanted.. here's my code and it's in HTML I code under portal_normal.vm
<div>
<img style="height: 160px;" src="/images/grp__NM__gcg_banner.png" border="0" width="100%">
</div>
velocity accepts html syntax,, but this code doesn't work,, I get my image under _diffs/images folder,,, I tried doing the following:
<img style="height: 160px;" src="../images/grp__NM__gcg_banner.png" border="0" width="100%">
<img style="height: 160px;" src="./images/grp__NM__gcg_banner.png" border="0" width="100%">
<img style="height: 160px;" src="_diffs/images/grp__NM__gcg_banner.png" border="0" width="100%">
<img style="height: 160px;" src="fullpathhere" border="0" width="100%">
but all of these aren't working
is there an alternative way or maybe my code is wrong?? suggestions please, thanks
I'm creating a theme template using velocity, however I can't seem to get the image that I wanted.. here's my code and it's in HTML I code under portal_normal.vm
<div>
<img style="height: 160px;" src="/images/grp__NM__gcg_banner.png" border="0" width="100%">
</div>
velocity accepts html syntax,, but this code doesn't work,, I get my image under _diffs/images folder,,, I tried doing the following:
<img style="height: 160px;" src="../images/grp__NM__gcg_banner.png" border="0" width="100%">
<img style="height: 160px;" src="./images/grp__NM__gcg_banner.png" border="0" width="100%">
<img style="height: 160px;" src="_diffs/images/grp__NM__gcg_banner.png" border="0" width="100%">
<img style="height: 160px;" src="fullpathhere" border="0" width="100%">
but all of these aren't working
is there an alternative way or maybe my code is wrong?? suggestions please, thanks
David H Nebinger, módosítva 8 év-val korábban
RE: Inserting Image in velocity HTML code
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Remember that when using an absolute path the path must point to an absolute image.
So "/images/grp..." means that for a tomcat deploy you would have the "webapps/ROOT/images/grp..." file which is not very likely.
Instead I think you're actually trying to get a dynamic path to the images folder relative to your theme. Instead of using a fixed value like this, use the following:
src="$images_folder/grp_..."
Per the values you can find here, this will expand to the appropriate place and you just have to know where in images your file actually is.
So "/images/grp..." means that for a tomcat deploy you would have the "webapps/ROOT/images/grp..." file which is not very likely.
Instead I think you're actually trying to get a dynamic path to the images folder relative to your theme. Instead of using a fixed value like this, use the following:
src="$images_folder/grp_..."
Per the values you can find here, this will expand to the appropriate place and you just have to know where in images your file actually is.
John Voltaire Maximo, módosítva 8 év-val korábban
RE: Inserting Image in velocity HTML code
Regular Member Bejegyzések: 106 Csatlakozás dátuma: 2015.06.19. Legújabb bejegyzések
I solved it using $images_folder...
it appears that liferay has these theme variables that I can use to get my resources..
for this particular problem I can either use
<div>
<img style="height: 160px;" src="$images_folder/grp__NM__gcg_banner.png" border="0" width="100%">
</div>
or
<div>
<img style="height: 160px;" src="$<img src="$themeDisplay.getPathThemeImages()//grp__NM__gcg_banner.png" border="0" width="100%">
</div>
Thank you
PS. I used these links for references
http://javaeasyforu.blogspot.in/2014/02/how-to-include-css-or-js-or-image-file.html
http://content.liferay.com/4.3/misc/theme-api-4.3.0.html
it appears that liferay has these theme variables that I can use to get my resources..
for this particular problem I can either use
<div>
<img style="height: 160px;" src="$images_folder/grp__NM__gcg_banner.png" border="0" width="100%">
</div>
or
<div>
<img style="height: 160px;" src="$<img src="$themeDisplay.getPathThemeImages()//grp__NM__gcg_banner.png" border="0" width="100%">
</div>
Thank you
PS. I used these links for references
http://javaeasyforu.blogspot.in/2014/02/how-to-include-css-or-js-or-image-file.html
http://content.liferay.com/4.3/misc/theme-api-4.3.0.html
David H Nebinger, módosítva 8 év-val korábban
RE: Inserting Image in velocity HTML code
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzésekJohn Voltaire Maximo:
PS. I used these links for references
http://javaeasyforu.blogspot.in/2014/02/how-to-include-css-or-js-or-image-file.html
Ugh. External blogs like this covered with ads and other crap, I don't really trust them. That being said, this one doesn't seem to be that bad but it is a year and a half old. But it is certainly better than:
http://content.liferay.com/4.3/misc/theme-api-4.3.0.html
See that version on there, Liferay 4.3? Do you think that you should really be using that as a reference these days? I mean, this is probably the one thing from 4.3 that hasn't changed, but little else still applies...
John Voltaire Maximo, módosítva 8 év-val korábban
RE: Inserting Image in velocity HTML code
Regular Member Bejegyzések: 106 Csatlakozás dátuma: 2015.06.19. Legújabb bejegyzések
hahaha, got it,, I'll always look at the wiki first.. or ask here instead haha