Foren

Failed to load Image in Liferay Portlet

Rounak Dasgupta, geändert vor 9 Jahren.

Failed to load Image in Liferay Portlet

New Member Beiträge: 4 Beitrittsdatum: 13.05.13 Neueste Beiträge
My development environment is liferay-portal-6.2-ce-ga2 and production environment is liferay 6.2 EE SP3. I'm able to deploy my dev portlet into prod but the problem that I'm facing is images are not rendering. It says Failed to load image url.

I'm using Liferay-JSF portlet and the image url is creating like /Project-portlet/icon.png. But in prod there are many war file is deployed and when I test with another portlet name something like (assume another portlet name is example-portlet) /example-portlet/icon.png, it works.

Is there any issue with context path of being different liferay version? Need your help.
thumbnail
Andew Jardine, geändert vor 9 Jahren.

RE: Failed to load Image in Liferay Portlet

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi Rounak,

There shouldn't be -- I just tried it with several of my portlets on my side and all of them worked. Make sure you have the servlet context name exactly as it shows in the directory though including case as as exact match must be found.

For images that you want to use in your portlet, unless you are using relative paths, you might have to use ${request.contextPath} to get the proper servlet path. So if you portlet has docroot/images/my-image.png then in your JSP you should use <img src="${request.contextPath}/images/my-image.png" />
thumbnail
Kyle Joseph Stiemann, geändert vor 9 Jahren.

Moved.

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Moved to Home » Liferay Faces » Liferay Faces - English
thumbnail
Kyle Joseph Stiemann, geändert vor 9 Jahren.

RE: Failed to load Image in Liferay Portlet

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Rounak,

Are you using an <img> tag or a JSF tag such as h:graphicImage?

- Kyle