2002 JI Open Discussion Posted August 19, 2006 Share Posted August 19, 2006 By: Brett - bsutton relative image path 2003-03-03 14:37 I am creating reports which will be deployed to multiple web sites (each with a different URL) and on multiple machines (each with a different directory structure). My reports include images and because of the different deployment environments I need to make the image paths relative to where the reports are stored or at least to the WEB-INF (I'm working with servlets). Is their any way to specify a relative path for an image. I've tried the obvious file://./image.jpg and file://image.jpg neither of which is working. Ideally I need to be able to tell the JRHtmlExporter class the root directory in which it should go looking for the images. P.S. I known the ImageExpression tag looks in the classpath but I'm unable to use that for other environmental reasons (i.e. I have no control over the classpath). By: Peter Kohlendorfer - kohlendorfer RE: relative image path 2003-03-04 00:38 Hi, first you do not need the "file://" prefix. Second you need to take care about the Java string escape character "/". An example for a working relative path would be: "..//images//image.gif" Greetings, Peter By: Teodor Danciu - teodord RE: relative image path 2003-05-10 03:30 Hi, If you take a look at the supplied "webapp" sample you can see that it displays an image. This image is located by passing the base directory as a parameter to the report when filling. I hope this helps. Teodor By: Adrian Dimulescu - dadi RE: relative image path 2003-11-20 05:51 Hello, I'm coming back to this subject: I have seen the way the webapp example deals with the path to the image -- but that involves sending a parameter to the report which I would prefer avoiding. Isn't there a simpler solution using a relative path ? Thank you, Adrian. By: Teodor Danciu - teodord RE: relative image path 2003-11-20 23:37 Hi, Images or subreports can also be loaded from classpath. You make the expression of type String and use the classpath relative location of the image file. Maybe this suits your needs. Thank you, Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now