Solved

Cannot display image from same directory

Posted on 2007-03-18
12
675 Views
Last Modified: 2012-05-05
Hi Experts
I am trying to learn the basics in writing html files so that I can understand the source codes generated in the files generated at work.  However, I am totally stuck with just trying to display an image from within the same directory.  The line I used is:
<img scr="image.jpg" width="400" height="100" alt="Image Banner" longdesc="test.html"></img>
This is virtually copied from examples given on the internet.  Can someone please tell me why this doesn't work.
Many thanks.
0
Comment
Question by:kwy
  • 6
  • 6
12 Comments
 
LVL 28

Expert Comment

by:gamebits
ID: 18745412
what is not working? The image is not displayed or you cannot access the test.html file.
0
 

Author Comment

by:kwy
ID: 18745418
the image is not displayed in the html file
0
 
LVL 28

Expert Comment

by:gamebits
ID: 18745454
<html>
<head>
<title>Test</title>
</head>

<body>

<h3>The picture should be under this title</h3>

<img src="image.gif" width="400" height="100" alt=="Image Banner" longdesc="test.html">

</body>
</html>

copy this code save it as display_image.html upload to your server and open up with your browser.

provided you upload this file in the same directory and provided there is an image named image.jpg in the directory it should display just fine. The longdesc attribut is poorly supported there is better alternative for that, in the actual code all you will get is a 404 file not found if you do not have a file in the same directory named test.html.
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:kwy
ID: 18745489
Hi gamebits, I tried it and the image is still not displaying.  But you mentioned to upload the file to a server.  If I have saved both files simply within a directory on the desktop of a stand alone PC, would that explan why the image is not being displayed?  Thanks
0
 
LVL 28

Expert Comment

by:gamebits
ID: 18745546
Open the directory (folder) right click the image, in the menu click property, there will be a line that display the location of the image something like

C:\Documents and Settings\cemond\Desktop\LFS

and in a window above that the name of the image
 something like that

Bolton_Map.jpg

change your image tag and put the absolute address instead of a relative one, following my example it would be

<img src="C:\Documents and Settings\cemond\Desktop\LFS\Bolton_Map.jpg" width="400" height="100" alt=="Image Banner" longdesc="test.html">
0
 

Author Comment

by:kwy
ID: 18745603
Tried that, still not working.  The line is:
<img src="C:\Documents and Settings\yuenl\Desktop\Image\image.gif" width="400" height="100" alt="Image Banner" longdesc="test.html">
Could it be an Explorer (v6) specific problem?
0
 
LVL 28

Expert Comment

by:gamebits
ID: 18745634
Do you have problem to display images usually, I mean if you surf the web the images are displayed?

 
0
 

Author Comment

by:kwy
ID: 18745644
only very rarely, but I think it is usually a website problem.
0
 

Author Comment

by:kwy
ID: 18745647
Also, when I use the following line, the image gets displayed:
<img src="http://www.w3schools.com/images/ie.gif">
0
 
LVL 28

Accepted Solution

by:
gamebits earned 50 total points
ID: 18745654
Try just the image tag without the longdesc attribute

<img src="C:\Documents and Settings\yuenl\Desktop\Image\image.gif" width="400" height="100" alt="Image Banner">
0
 

Author Comment

by:kwy
ID: 18745662
WORKED !!  Thanks very much.
0
 
LVL 28

Expert Comment

by:gamebits
ID: 18745670
Glad to help.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Browser Chrome downloads colored link 5 48
VBScript on Html 15 47
Output to HTML in powershell 3 25
Non-Resizable Pharagraph 2 5
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question