Solved

Cannot display image from same directory

Posted on 2007-03-18
12
674 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why is this panel heading creating extra space 2 50
Set differnt row widths in a table. 3 22
execute script based on HTML event 7 23
Scroll 5 news at a time. 4 27
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

770 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