Solved

Cannot display image from same directory

Posted on 2007-03-18
12
673 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
Comment Utility
what is not working? The image is not displayed or you cannot access the test.html file.
0
 

Author Comment

by:kwy
Comment Utility
the image is not displayed in the html file
0
 
LVL 28

Expert Comment

by:gamebits
Comment Utility
<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
 

Author Comment

by:kwy
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 28

Expert Comment

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

 
0
 

Author Comment

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

Author Comment

by:kwy
Comment Utility
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
Comment Utility
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
Comment Utility
WORKED !!  Thanks very much.
0
 
LVL 28

Expert Comment

by:gamebits
Comment Utility
Glad to help.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now