Current Url generates Exception:NULL..........

Sanket Gosavi, modified 14 Years ago. Junior Member Posts: 35 Join Date: 12/24/11 Recent Posts
M not able to display any image on portlet................
<img src="H:/arr.jpg" height="100" width="200"/>
<liferay-ui:png-image image="H:/arr.jpg" height="100" width="500"></liferay-ui:png-image>
none of it works......
12:50:37,084 INFO [PortalImpl:3829] Current URL /en_GB/web/sanketgosavi/arr.png generates exception: null
thumbnail
Ravi Kumar Gupta, modified 14 Years ago. Liferay Legend Posts: 1302 Join Date: 6/24/09 Recent Posts
Try putting that image in your portlet. Like if that is in your-portlet/images/arr.png then use
<img src="<%=request.getContextPath()%>/images/arr.png">
thumbnail
David H Nebinger, modified 14 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
You cannot use fixed paths to images, all images must be relative to the web application.

That is a basic web server development thing which you should already be aware of to undertake web development.
Sanket Gosavi, modified 14 Years ago. Junior Member Posts: 35 Join Date: 12/24/11 Recent Posts
i knw dat...i want a way to do that
thumbnail
David H Nebinger, modified 14 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
You cannot. It's an application server thing, not just something you can override. It is there to ensure that you do not serve up resources outside of the application container, which would be a potential security leak.
Sanket Gosavi, modified 14 Years ago. Junior Member Posts: 35 Join Date: 12/24/11 Recent Posts
Well...plzzzzz tell me wht i hav do to display image on d portlet....
thumbnail
Ravi Kumar Gupta, modified 14 Years ago. Liferay Legend Posts: 1302 Join Date: 6/24/09 Recent Posts
As I previously mentioned and David also explaining, image should be in your document root. If you are not doing so, then serve those images using a different method. Which is not at all recommended, will decrease performance and not tested by me.. emoticon

You can write a method which loads image content from local file and sends it to application. serveResource() method may be used, I guess. But for that you will need to change all urls to get resources by serveResource.. I don't know whether its possible but you can try..

David: is that really possible?
Sanket Gosavi, modified 14 Years ago. Junior Member Posts: 35 Join Date: 12/24/11 Recent Posts
It worked....thnks.....Can i display text keeping the image as background?
thumbnail
Ravi Kumar Gupta, modified 14 Years ago. Liferay Legend Posts: 1302 Join Date: 6/24/09 Recent Posts
Of course yes... depends on how you are writing that.
Sanket Gosavi, modified 14 Years ago. Junior Member Posts: 35 Join Date: 12/24/11 Recent Posts
how?..is der any attribute or somthing...
thumbnail
Ravi Kumar Gupta, modified 14 Years ago. Liferay Legend Posts: 1302 Join Date: 6/24/09 Recent Posts
Will background-image property of css not help? check this http://www.w3schools.com/css/css_background.asp

Just place the image url at appropriate position. Suppose abc is the id of the element you want to set background of..

#abc{background-image:url('paper.gif');}


HTH
Haris Tasawar, modified 13 Years ago. Junior Member Posts: 35 Join Date: 6/4/12 Recent Posts
i want to do this too... but instead of an image, i want to display a PDF file, how would that work. If its possible, let me know.

Thanks.
Haris