Can't display images

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi All,

 I am preety new to web development.
 I must be missing something very basic here.

 I developed a php file named Register.php.
 I put couple of images in it.
 I use apache tomcat 6.0

 I loaded the file by typing http://localhost:8080/forphp/Register.php
on the address bar  in IE8.

 The images are not loaded.

 The images properties shows that they refer to http://localhost:8080/<image
file name> as the image is at the same folder like Register.php

 The folder forphp is under webaps directory which is in tomcat

The tomcat service is up.

Any help will be appreciated.


Re: Can't display images

On Thu, 21 Jan 2010 12:32:34 -0800 (PST), dushkin put finger to
keyboard and typed:

Quoted text here. Click to load it

There's your problem, then. You've given the images an absolute
instead of relative path, and they're being loaded (or, rather,
failing to load) from the root directory.

Your HTML source looks something like this:

<img src="/image.jpg">

whereas it should look like this:

<img src="image.jpg">

or this:

<img src="/forphp/image.jpg">

The first of those (note the absence of the leading /) makes the image
location relative to the file calling it rather than the root
directory, while the second uses an absolute path (with a leading /)
and includes the directory where the images are located.


Re: Can't display images

Mark, You are correct!
Thanks a lot!

Site Timeline