Jump to content
xisto Community

Image Calling Problem Solved I was having issues trying to call an image from a folder.

Recommended Posts

Alright so this is for example You'd have a site and the structure is like this. http://search.url.com/ a folder of images /images/ and some pages in this parent directory. However, I have another folder so it's http://forums.xisto.com/no_longer_exists/ and this index page needs to call things from http://forums.xisto.com/no_longer_exists/ and it can't. It won't load. I've had the call be to

<img src="images/" or <img src="../images/" and <img src="www.url.com/images/;

It doesn't work. I can't call to the URL 'cause the server dosen't allow remote calling, changing that is not an option. It won't call from a directory cause it'll think it's that directory it's calling in like it'd goto http://forums.xisto.com/no_longer_exists/ not http://forums.xisto.com/no_longer_exists/ and I can't make it go back, it only works for server side stuff, and I'm going like a background image for example. Why would I need to call a server side to bring in a background image. I went back and I figured that the problem was because the code was without a / in the folder call

<img src="/images/

So let this be a lesson learned! If you are not getting the result you want. Make sure to check and check and check and check again your code. The solution is in the environment.


Share this post

Link to post
Share on other sites

Couple of things to add to this discussion.


1. The href is incomplete. You are lacking the file reference in the sample code.

     I added file_name.jpg to correct it.


2. You are missing the title attribute, which acts as the 'tooltip' for the on-hover event. I added that.


3. You failed o close the image tag. I added it, too.


Your html code should read as follows:

<img src="http://www.coolchaser.com/; title="Title here" />
<img src="./images/file_name.jpg" title="Title here" />
<img src="../images/file_name.jpg" title="Title here" />

Depending on the position of the Images folder relative to the calling file, one of those should work. The "./" is if the Image is referenced from the same folder. Likely so in your case. The "../" is if the Image is referenced from 'up' one folder and then into the Images folder. The Http reference is 'absolute' to the URL. The thing to use if the Images are stored on a Web Server outside your Domain, for example, but it could also be the same Domain. Using the first or second example makes your code more portable, in that the reference is relative to the html page and does not tie the Image source to a particular Server location.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.