on 04-06-2006 4:40 PM
Hi anyone help me out to get this issue solved...
I'm creating PDF on the fly but I'm unable to get the image in it. It says Invalid path if i give the path like this Image image =new Image( request.getWebResourcePath() + /images/MyLogo.gif","picture Mylogo.gif");
And also I have tried like this
com.lowagie.text.Image img = com.lowagie.text.Image.getInstance("MyLogo.gif"); document.add(img);
I have kept the image in /images folder.
Still i'm facing path problem....
Please guide me to resolve this issue..
Regards,
Joseph
Hi,
you can try like this..
<%
IResource rs = componentRequest.getResource(IResource.IMAGE, "../mimes/mypicture.gif");
image.setSrc(rs.getResourceInformation().getURL(componentRequest));
%>
Regards,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthick,
req.getPrivateResourcePath returns for example:
<i>C:\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\TestPortalApplication</i>
Now add your images path and image name to this path and you can access the file as per standard Java IO.
That's what has been needed in this thread.
Hope it helps
Detlev
Hi Joseph,
the code is given above, it's as easy as described. If you put your image into your NWDS portal project under dist/PORTAL_INF/images (create that last folder), just add "images/yourImage.gif" to the path retrieved. This is the scenario if you only want to access the image on server side. If you also want to offer the image from client side (not described in your question), put it under dist/images and use getPublicResourcePath() instead for server side access.
Hope it helps
Detlev
Hi Joseph,
Your images will be stored under..
NWDS path :
dist/images/your_image.gif
Server path:
E:\usr\sap\DP4\JC04\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps\your_par_name\images\your_image.gif
you can access the image from this server path..
->
request.getPrivateResourcePath() will give you the path upto ..
E:
usr
sap
DP4
JC04
j2ee
cluster
server0
apps
sap.com
irj\servlet_jsp
irj
root
WEB-INF
portal
portalapps\
come back 2 directories back upto..
root\your_par_name\your_image_name
Try this and let me know.
Hope it helps.
Regards,
Karthick
Hi Joseph, hi Karthick,
the path you have decribed, Karthick, to put and to retrieve the image, is the one to be used when using <i>getPublicResourcePath()</i>, not when using getPrivateResourcePath().
When using getPrivateResourcePath(), put - as already described - the image under dist/PORTAL_INF/images.
@Joseph: It definitely works! Please debug your code if it still doesn't, tell us what getXXXResourcePath returns, check the path on your system etc pp. "Does not work" is <i>always</i> an error description almost nobody can work on...
Hope it helps
Detlev
Hi Joseph,
You have to Keep your image under dist/images/MyLogo.gif.
In your jsp access the image like this.
javascript:
var imgSrc = '<%= componentRequest.getWebResourcePath() %>/images/MyLogo.gif;
<img src="imgSrc" />
Hope it helps.
Regards,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joseph,
see https://media.sdn.sap.com/javadocs/NW04/SPS15/ep/com/sapportals/portal/prt/component/IPortalComponen... (or getPrivate...()).
Starting with this, you can access the file.
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.