LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Image Path reference in Linux (Absolute path) (https://www.linuxquestions.org/questions/linux-general-1/image-path-reference-in-linux-absolute-path-385775/)

javabuddy 11-23-2005 05:58 AM

Image Path reference in Linux (Absolute path)
 
Hi

I am a JSP/Servlet developer.
I am new to Linux server environment.
I am experiencing a problem with Image Path reference in Linux server.

My application (myapp.war) is running in Linux in the following path:
/opt/jboss-3.2.6/server/default/deploy/myapp.war
The myapp.war is having the html,xml,jsp and servlet files.

I stored the images in a different location. The reason is, the images can be frequently changed.
/var/myapp_images/ABC/image1.gif

I want to refer the above image in the <IMG> tag of the html file.

If I give the <IMG> tag like below, the jboss servlet context is taking effect, i.e., the

/opt/jboss-3.2.6/server/default/deploy folder.

<IMG src = "/var/myapp_images/ABC/image1.gif">

The image is not loaded from the particular location. It shows an empty area with red color x mark.

But, the browser shows the address of the image as url/var/myapp_images/ABC/image1.gif.

(The url has the IP address and 8080 port number.)
Image Type : Not available.
Image Size : Not available.

How can I refer the image which is in a different location?

My Operating System is : Windows 2000.
JBOSS3.2.6 is running in : Linux server.
I am testing the myapp application in my Windows 2000.

I have given the absolute path reference for image. But it is not taking effect.
Anything needs to be configured / altered?

Please help me to fix this issue.

Thanks,
JavaBuddy.

AdaHacker 11-23-2005 07:43 AM

I have no clue on JSP, so forgive me if this is way off.

You said that you're referencing the image in an HTML file. Unless your app is doing some kind of processing on the HTML file to adjust the path before serving it, giving the real local path won't work. A client browser will always interpret a path like that as relative to the web root of the server.

In order for clients to find the image, you need to put it under your DocumentRoot (as set in your Apache configuration) and use a path relative to that. So if your document root is /var/mysite, you might put the image in /var/mysite/images/image1.gif and give the URL as /images/image1.gif.

javabuddy 11-23-2005 09:33 PM

AdaHacker, thanks for your reply.

Its good to store the images inside the Document Root.

But the images are not permanent. They are temporary only. They can be changed daily. So, images should not be stored inside the Document root.

If it is inside the Document Root, then the JBOSS server needs to be stopped and started daily to finish the build process.

Is there any options to create a link file which maps to the /var/myapp_images directory from /opt/jboss-3.2.6/server/default/deploy/.?

Thanks,
JavaBuddy.

AdaHacker 11-24-2005 08:11 AM

Quote:

Originally posted by javabuddy

Is there any options to create a link file which maps to the /var/myapp_images directory from /opt/jboss-3.2.6/server/default/deploy/.?
Yeah, you could try making a symlink under your document root instead of putting the actual files there. That should work. Of course, you would need make sure following symlinks is enabled in your Apache configuration.

javabuddy 11-28-2005 04:27 AM

Thanks AdaHacker.

I added the "/var/myapp_images" directory to the "jboss-service.xml" file in "opt/jboss-3.2.6/server/default/conf/" directory.

<attribute name="URLs">
deploy, file://var/myapp_images"
</attribute>

Thanks for your idea to look on to the configuration settings.
Now the problem is fixed.

JavaBuddy.

mocha_java 06-02-2006 11:20 AM

I have the same problem but I could not make it work. Could anybody give me some idea? Here is my settings:

jboss-service.xml:
<attribute name="URLs">
deploy/,file://tmp/images
</attribue>

test.jsp:
<img src="/tmp/images/image1.gif" alt="" width="50" height="20">

I got
"The requested resource (/tmp/images/image1.gif) is not available."
from jboss.

Thanks

javabuddy 06-04-2006 10:23 PM

Hi,

You should have a folder or directory named with .war extension under the /tmp/images/ (like, /tmp/images/abc.war), else the JBOSS server wont refer the image file. All your images should be copied inside the abc.war file. Adjust your image reference in JSP or HTML to get them from the /tmp/images/abc.war.

Refer "Hot Deployment in JBOSS" for more details.
http://www.jboss.com/index.html?modu...wtopic&t=73022

Thanks,
JavaBuddy.

mocha_java 06-05-2006 07:45 AM

Thank you very much! I tried and it works!


All times are GMT -5. The time now is 06:02 AM.