Solved

Cannot display image from same directory

Posted on 2007-03-18
12
678 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses how to create an extensible mechanism for linked drop downs.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

623 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