Author |
Message |
17/09/2010 12:56:38
|
jsingh
Active
Joined: 17/09/2010 12:50:02
Messages: 12
Offline
|
in image shaker if i put some absolute path for images, its not reading the images. names are getting displayed properly but only blacks in image shaker
code snip:
File dir = new File("D:/emp/doc");
String[] children = dir.list();
if (children == null) {
} else {
for (int i=0; i<children.length; i++) {
String filename = children[i];
StringBuffer image = new StringBuffer();
image.append("/bgpaint(210,200):");
image.append("rectangle(0,0,100%,100%,#000000)");
image.append(";image(5,5,D:/emp/doc/"+children[i]+",lefttop)");
System.out.println("file name here is now "+image);
// image.append(";write(25,150,"+COMMENTS[i]+",10,#FFFFFF,lefttop)");
// image.append(";write(25,170,"+AUTHORS[i]+" on Canon Ixus,10,#E0E0E0,lefttop)");
shaker.addImage(image.toString());
}
|
|
|
17/09/2010 13:34:25
|
mreich
Power User
Joined: 30/01/2009 08:34:23
Messages: 744
Offline
|
I think it would be better when you use relative paths, e.g. if you got a directory images in your webcontent directory you can reference by /images/picture.gif
Markus
|
|
|
17/09/2010 17:35:33
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
Hi,
Markus is 100% right.
You need to define paths that relate to your web content directory. E.g. if you webapplicaiton looks like:
Code:
webcontent
WEB-INF
META-INF
images
niceImage.png
... then you can reference the image via "/images/niceImage.png"
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
17/09/2010 18:23:34
|
jsingh
Active
Joined: 17/09/2010 12:50:02
Messages: 12
Offline
|
so guys does it mean i can not give absolute path pointing to some other location than webcontents?I need to upload images at run time , each user will upload differnent images. so shall i put all user account imgaes into web contents only?
|
|
|
17/09/2010 18:26:51
|
jsingh
Active
Joined: 17/09/2010 12:50:02
Messages: 12
Offline
|
Also if names are being read properly from absolute path " d:/emp/doc/" ,then whats the issue with displaying those?
|
|
|
17/09/2010 21:04:07
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
Hi Jasvir,
there must be some misunderstanding ;-)
The images that you refer to (in BUTTON, ICON, IMAGE, IMAGESHAKER, ...) are relative URLs that are resolved from the client. Same as in an HTML browser. So the image-URL is a relative one, pointing into your web application on server side.
So by getting image "/images/xyz.png" the client requests this image from the server (if not already cached). And the request in the server is going to the web app, i.e. to "tomcat/webapps/<yourwebapp>/images/xyz.png".
Does this make things clearer? Maybe I do not fully understand what you want to do? If so, please tell me.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
18/09/2010 07:17:23
|
jsingh
Active
Joined: 17/09/2010 12:50:02
Messages: 12
Offline
|
Hi Bjoern,
Actually i am not talking about the button images and all, my functionality says,HR manager will fill up the new joinee emp details along with his/her experience/educational certificates . so he/she will upload them and server code will put them to some specified locations by establishing relationship with emp and his docs.
So as long as he continues to upload , those should be visible to him in a shaker.so shaker should be able to fetch the docs from that location .
hope it would clarify the things now
|
|
|
18/09/2010 08:19:52
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
Hi Jasvir,
you can do the following:
(1.) store the images in the database as binary stream
or
(2.) store them in the file system (e.g. servlet temp directory or in some directory that is part of you configuration)
Now: the client needs to acces this data (e.g. images) via URL to the server side data. So you need to provide this URL.
You can either write a servlet for this on your own, or you may use the BufferedContentMgr to do so - please check in the documentation, it's explained in the file download management (search for "BufferedContent").
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
18/09/2010 08:22:45
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
...forgot to mention: when using option (1.) then your application will not be able to provide session-state-migration from one node to the next. I.e. if running in a cluster environment with 2 servers, the first request may go to server1, the seconde to server2. If storing data in the files system of server1 then of course the second request will not see this info anymore.
Well, in "typical scenarios", this may not be realistic, because you may expect sticky session state in any case, but I jsut wanted to make sure...
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
18/09/2010 09:22:19
|
jsingh
Active
Joined: 17/09/2010 12:50:02
Messages: 12
Offline
|
Yes Bjoern ,
I am not willing to put images in database for both reason i.e clustering session issue and also i dont want to put this extra load to DB, why one should query heavy image from db over network , that would be expensive.
let me think of some other alternative.
thanks
|
|
|
18/09/2010 11:08:16
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
Hi,
to support transfer-able session state is a quite huge task for the application - any that should be preserved need to be serializable and you have to take great care about initialization of objects + handling "static" objects.
So, from my experience, most applications are session-sticky anyway...
I would start to store the images somewhere in the file system (e.g. servelt temp directory) + behind a certain Java-API, expecting that sessions are sticky. If then being able to really support transfer-able sessions, then you can extend the implementation behind the interface.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
18/09/2010 11:13:39
|
jsingh
Active
Joined: 17/09/2010 12:50:02
Messages: 12
Offline
|
thanks but i dont need transferable session anyway. so i might be writting my own servlet to access images
|
|
|
|