Foros de discusión
Generate a right path
George Smith, modificado hace 11 años.
Generate a right path
New Member Mensajes: 24 Fecha de incorporación: 9/01/13 Mensajes recientes
Hi!
I save uploaded image files in tomcat or portlet temporary directory, and I want to display them. I know their path in server file system, but how generate a right path for displaying it on portlet's page? It must become from smth like:
to smth like:
How to get it? How to display image from some server directory in portlet?
I save uploaded image files in tomcat or portlet temporary directory, and I want to display them. I know their path in server file system, but how generate a right path for displaying it on portlet's page? It must become from smth like:
opt/liferay/tomcat-7.0.27/temp/28-Image-portlet/WEB-INF/classes/intech/webpro/kegor/image/Clipboard02.jpg
to smth like:
http://localhost:8081/web/guest/liferay-benefits?p_p_id=Image_WAR_Imageportlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-1&p_p_col_count=1&_Image_WAR_Imageportlet_javax.faces.resource=Clipboard02.jpg&_Image_WAR_Imageportlet_ln=images
How to get it? How to display image from some server directory in portlet?
Hitoshi Ozawa, modificado hace 11 años.
RE: Generate a right path
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Not sure what you're trying to do. Images are usually saved in portlet's docroot\img directory.
Access it from a portlet as below:
<%=request.getContextPath()%>/img/image1.png
I just wrote an article (unfortunately in Japanese) explaining how to write a simple slide show portlet.
There's a sample code accessing image file in a portlet. It's a little bit down the page. Looking at the code may help you.
http://gihyo.jp/design/serial/01/liferay/0003?page=4
Access it from a portlet as below:
<%=request.getContextPath()%>/img/image1.png
I just wrote an article (unfortunately in Japanese) explaining how to write a simple slide show portlet.
There's a sample code accessing image file in a portlet. It's a little bit down the page. Looking at the code may help you.
http://gihyo.jp/design/serial/01/liferay/0003?page=4