Solved

Cannot display image from same directory

Posted on 2007-03-18
12
677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

752 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